mgalardini / pyseer

SEER, reimplemented in python 🐍🔮
http://pyseer.readthedocs.io
Apache License 2.0
104 stars 25 forks source link

Trying to run tutorial and getting an eror #134

Closed waalkes closed 3 years ago

waalkes commented 3 years ago

Everything was working great until:

(base) tron:/mnt/projects/200922_vertex_pangenome/gff/pyseer_tutorial $ pyseer --phenotypes resistances.pheno --pres gene_presence_absence.Rtab --distances mash.tsv --save-m mash_mds --max-dimensions 8 > penicillin_COGs.txt Read 603 phenotypes Detected binary phenotype Structure matrix has dimension (616, 616) Analysing 603 samples found in both phenotype and structure matrix Traceback (most recent call last): File "/home/local/AMC/waalkes/miniconda2/bin/pyseer", line 10, in sys.exit(main()) File "/home/local/AMC/waalkes/miniconda2/lib/python2.7/site-packages/pyseer/main.py", line 300, in main null_fit = fit_null(p.values, m, cov, options.continuous) File "/home/local/AMC/waalkes/miniconda2/lib/python2.7/site-packages/pyseer/model.py", line 99, in fit_null null_mod = smf.Logit(p, v) AttributeError: 'module' object has no attribute 'Logit'

Do I need to install some additional software?

Thanks

mgalardini commented 3 years ago

Hi, could you tell me what is your statsmodels version please? Do the following to find out:

$ python
>>> import statsmodels
>>> statsmodels.__version__
waalkes commented 3 years ago

(base) tron:/mnt/data/projects/200922_vertex_pangenome/gff/pyseer_tutorial $ python Python 2.7.18 |Anaconda, Inc.| (default, Apr 23 2020, 22:42:48) [GCC 7.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import statsmodels statsmodels.version u'0.10.2'

mgalardini commented 3 years ago

Ok, I think that is too old of a version. Could you update it please? Depending on how you installed it you can do either:

python -m pip install statsmodels --upgrade

or

conda update statsmodels
waalkes commented 3 years ago

I updated via conda and it seemed to work but when I ran pyseer again I got the same error. I then did the statsmodels version and it was still u'0.10.2' I then tried to update statsmodels again and it said # All requested packages already installed See here:

(base) tron:/mnt/disk4/labs/salipante/data/projects/200922_vertex_pangenome/gff/pyseer_tutorial $ python Python 2.7.18 |Anaconda, Inc.| (default, Apr 23 2020, 22:42:48) [GCC 7.3.0] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import statsmodels statsmodels.version u'0.10.2' quit() (base) tron:/mnt/disk4/labs/salipante/data/projects/200922_vertex_pangenome/gff/pyseer_tutorial $ conda update statsmodels Collecting package metadata (current_repodata.json): done Solving environment: done

==> WARNING: A newer version of conda exists. <== current version: 4.8.3 latest version: 4.9.2

Please update conda by running

$ conda update -n base conda

All requested packages already installed.

I tried to update conda like it says and it gave me the same message not actually updating conda that I can tell.

waalkes commented 3 years ago

bold and large font was not from me it changed when I submitted the comment

johnlees commented 3 years ago

I think this has changed in statsmodels

https://github.com/mgalardini/pyseer/blob/master/pyseer/model.py#L17 Now needs to be import statsmodels.api as smf And I guess we need to update our try/excepts appropriately too

mgalardini commented 3 years ago

I think the OP statsmodels version is too old; the code works with the latest version.

@waalkes can you try conda install statsmodels==0.12.1?

johnlees commented 3 years ago

Ah wait - your try/except already handles this update doesn't it! That was back in v0.10 or v0.11? Sorry, had lost track of that

mgalardini commented 3 years ago

No worries! Weird thing is that the tests are passing even with OP's version, so maybe there could be something wrong with the environment etc..

waalkes commented 3 years ago

Looks like 0.12.1 requires a later version of python?

(base) tron:/mnt/projects/200922_vertex_pangenome/gff/pyseer_tutorial $ conda install statsmodels==0.12.1 Collecting package metadata (current_repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: failed with repodata from current_repodata.json, will retry with next repodata source. Collecting package metadata (repodata.json): done Solving environment: failed with initial frozen solve. Retrying with flexible solve. Solving environment: - Found conflicts! Looking for incompatible packages. This can take several minutes. Press CTRL-C to abort. failed

UnsatisfiableError: The following specifications were found to be incompatible with the existing python installation in your environment:

Specifications:

Your python: python=2.7

If python is on the left-most side of the chain, that's the version you've asked for. When python appears to the right, that indicates that the thing on the left is somehow not available for the python version you are constrained to. Note that conda will not change your python version to a different minor version unless you explicitly specify that.

mgalardini commented 3 years ago

Oh I see! I'd suggest using python version 3 and higher, as python 2 is now not supported anymore.

waalkes commented 3 years ago

Sorry to have wasted your time. It all works fin when I updated to minicoda3

mgalardini commented 3 years ago

No problem! Glad it works now!