benedictpaten / marginAlign

UCSC Nanopore
MIT License
42 stars 13 forks source link

ImportError: No module named pysam #49

Open ghost opened 5 years ago

ghost commented 5 years ago

I am attempting to install marginAlign into a cluster environment utilising the lmod modules system (so I suppose I am also echoing alanorth's request to please tag your releases in git).

I have satisfied each of the dependencies listed in the requirements.txt and am able to import them successfully into the system python.

However, running any of the executables results in an import error related to pysam:

./marginAlign
Traceback (most recent call last):
  File "./src/margin/marginAlign.py", line 7, in <module>
    from margin.mappers.last import Last, LastChain, LastRealign
  File "/usr/local/installed/marginalign/0.1/src/margin/mappers/last.py", line 1, in <module>
    from margin.mappers.abstractMapper import AbstractMapper
  File "/usr/local/installed/marginalign/0.1/src/margin/mappers/abstractMapper.py", line 2, in <module>
    from margin.marginAlignLib import chainSamFile, realignSamFileTargetFn
  File "/usr/local/installed/marginalign/0.1/src/margin/marginAlignLib.py", line 1, in <module>
    import pysam, sys, os
ImportError: No module named pysam

./marginCaller
Traceback (most recent call last):
  File "./src/margin/marginCaller.py", line 7, in <module>
    from margin.utils import pathToBaseNanoporeDir
  File "/usr/local/installed/marginalign/0.1/src/margin/utils.py", line 1, in <module>
    import pysam, sys, os, random
ImportError: No module named pysam

./marginStats
Traceback (most recent call last):
  File "./src/margin/marginStats.py", line 5, in <module>
    from margin.utils import ReadAlignmentStats
  File "/usr/local/installed/marginalign/0.1/src/margin/utils.py", line 1, in <module>
    import pysam, sys, os, random
ImportError: No module named pysam

Is there any other requirement related to pysam that needs to be satisfied in order to be able to run marginAlign against the system python?

mitenjain commented 5 years ago

Sorry for the hassle. I agree we need to tag our releases in git, and will get this effected shortly.

Re: pysam, if your system python has the same version of pysam (and other dependencies as in requirements.txt) then it should be fine. I haven't tested lmod thus far, but can do it next week.

Did you create a virtualenv? It may be worth trying to do it via the virtualenv?

ghost commented 5 years ago

Thanks for your prompt reply. Unfortunately we sort of prefer not to complicate our cluster environment by installing a virtualenv. I was initially using a slightly newer version of pysam (0.9.0), however, I have also tested with the version listed in the reqs. (0.8.2.1) without success. Looking forward to the results of your lmod test.

mitenjain commented 5 years ago

Pysam 0.8.2.1 not working is weird. What is the OS on your cluster? I'll try to reproduce the issue on our end if possible.

ghost commented 5 years ago

CentOS release 6.7 (Final)

(we are definitely due for an upgrade!)

agos316 commented 4 years ago

Hi, I ran into the same problem, check your pysam install, if it says it isn't installed just install on your virtualenv, if it works try the code again, I had to install htslib in the virtual environment to get pysam to install

Note: ensure that the install is pysam=0.8.2.1 or youll run into a string index error

Best

Marc