Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ImportError: No module named pysam #49

Open
ghost opened this issue Jun 27, 2019 · 5 comments
Open

ImportError: No module named pysam #49

ghost opened this issue Jun 27, 2019 · 5 comments
Assignees

Comments

@ghost
Copy link

ghost commented Jun 27, 2019

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 mitenjain self-assigned this Jun 27, 2019
@mitenjain
Copy link
Collaborator

mitenjain commented Jun 27, 2019

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
Copy link
Author

ghost commented Jun 28, 2019

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
Copy link
Collaborator

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
Copy link
Author

ghost commented Jun 28, 2019

CentOS release 6.7 (Final)

(we are definitely due for an upgrade!)

@agos316
Copy link

agos316 commented Aug 2, 2019

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants