pysamstats icon indicating copy to clipboard operation
pysamstats copied to clipboard

error of pysamstats while using python2.7.14

Open douym opened this issue 6 years ago • 5 comments

Hi alimanfoo,

when I try to import pysamstats under python2, there is an error:

import pysamstats Traceback (most recent call last): File "", line 1, in File "/n/data1/hms/dbmi/park/yanmei/tools/anaconda3/envs/python2/lib/python2.7/site-packages/pysamstats/init.py", line 8, in from .pileup import * File "/n/data1/hms/dbmi/park/yanmei/tools/anaconda3/envs/python2/lib/python2.7/site-packages/pysamstats/pileup.py", line 6, in import pysamstats.opt as opt File "libcfaidx.pxd", line 52, in init pysamstats.opt AttributeError: 'module' object has no attribute 'FastxRecord'

if I import pysamstats under python3.6.1, then it's completely normal.

Do you know how should I do to fix that? thanks a lot!

douym avatar Apr 27 '18 18:04 douym

Hi @douym, this type of error is usually due to a version mismatch between pysamstats and pysam. The current release version of pysamstats (1.0.1) needs to be installed together with pysam version 0.11.2.2. E.g.:

pip install pysam==0.11.2.2
pip install pysamstats==1.0.1

You can check what versions you have installed, e.g.:

python -c 'import pysam; import pysamstats; print(pysam.__version__, pysamstats.__version__)'

I'm guessing your python2 environment has a different version of pysam.

alimanfoo avatar Apr 30 '18 21:04 alimanfoo

Closing but feel free to re-open if problem is not resolved.

alimanfoo avatar May 10 '18 22:05 alimanfoo

I have exactly the same error message when installing with conda. I've uninstalled both pysam and pysamstats, installed the correct versions (pysam==0.11.2.2 & pysamstats==1.0.1; btw, Python 2.7.14 :: Anaconda, Inc.), and the error persists. Do you have any extra ideas, please?

Unfortunately, at the moment, I can't install via pip, cause I've made the mistake of upgrading it, and I lost pip –working on solving this issue as well...

Thanks in advance for your support, I just wanna go back to work with pysamstats: such a useful tool!

frabanal avatar Jul 08 '18 12:07 frabanal

Apologies @frabanal this got lost in my email backlog. Did you solve this problem, or is it still relevant?

alimanfoo avatar Aug 31 '18 13:08 alimanfoo

Hi alimanfoo, I get the same error and my installation method as follow: 1.copy source code from github 2.~/pysamstats-master $ python setup.py install [pysamstats] build with Cython 3.test:~/pysamstats-master $ nosetests -v Failure: ModuleNotFoundError (No module named 'pysamstats.opt') ... ERROR

====================================================================== ERROR: Failure: ModuleNotFoundError (No module named 'pysamstats.opt') Something I have missed about the question? hope your answer,thank you !

Lidweixiang avatar Aug 14 '19 04:08 Lidweixiang