Tutorial: AttributeError: 'NoneType' object has no attribute 'rownames'AttributeError: 'NoneType' object has no attribute 'rownames'

Hello,

It’s my first time trying lefse through CLI, but i get the following error when I run the tutorial pipeline, in the lefse_run step, here’s the detailed error:

(test) MacBook-Pro-de-Taha:Desktop tahazakariya$ lefse_run.py hmp_aerobiosis_small.in hmp_aerobiosis_small.res
Number of significantly discriminative features: 51 ( 131 ) before internal wilcoxon
Traceback (most recent call last):
  File "/Users/tahazakariya/opt/anaconda3/envs/test/bin/lefse_run.py", line 8, in <module>
    sys.exit(lefse_run())
  File "/Users/tahazakariya/opt/anaconda3/envs/test/lib/python3.9/site-packages/lefse/lefse_run.py", line 90, in lefse_run
    if params['rank_tec'] == 'lda': lda_res,lda_res_th = test_lda_r(cls,feats,class_sl,params['n_boots'],params['f_boots'],params['lda_abs_th'],0.0000000001,params['nlogs'])
  File "/Users/tahazakariya/opt/anaconda3/envs/test/lib/python3.9/site-packages/lefse/lefse.py", line 222, in test_lda_r
    rowns = list(rres.rownames)
AttributeError: 'NoneType' object has no attribute 'rownames'

Note that I used a new environment with only python and R required packages.
Can someone provide some help please ? Thanks

Hi Taha,
I had the same issue, which I suppose is related to updates of the dependencies. However, I managed to overcome this by installing the previous versions of rpy2 (3.5.10) and numpy (1.24.3).
Hope this helps!

1 Like

I’m having the same issue. I tried installing rpy2==3.5.10 and numpy==1.24.3 but still get the error. For reference, this is the error (very similar to Taha):

(lefse) al59331@MCW-19487 exported_baselines_table_L4 % lefse_run.py L4.in L4.res
Number of significantly discriminative features: 20 ( 22 ) before internal wilcoxon
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.12/bin/lefse_run.py", line 8, in <module>
    sys.exit(lefse_run())
             ^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/lefse/lefse_run.py", line 90, in lefse_run
    if params['rank_tec'] == 'lda': lda_res,lda_res_th = test_lda_r(cls,feats,class_sl,params['n_boots'],params['f_boots'],params['lda_abs_th'],0.0000000001,params['nlogs'])
                                                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/site-packages/lefse/lefse.py", line 222, in test_lda_r
    rowns = list(rres.rownames)
                 ^^^^^^^^^^^^^
AttributeError: 'NoneType' object has no attribute 'rownames'