manually installing pysam error: "ImportError: No module named version"

1.9k Views Asked by At

I am trying to install pysam manually as I am working on a cluster without internet connection and I do not have admin rights (thus doing it through conda is not possible, which I have tried). I have downloaded all the zipped files from the developer's repository (https://github.com/pysam-developers/pysam/archive/master.zip), then I transfer them to my directory in the cluster.

I have tried the manual installation from the unzipped repository by running (as indicated in the instructions https://github.com/pysam-developers/pysam/blob/master/INSTALL):

python path/to/pysam-master/setup.py build

But I get the following error:

# pysam: cython is available - using cythonize if necessary
Traceback (most recent call last):
  File "path/to/pysam-master/setup.py", line 166, in <module>
    import version
ImportError: No module named version

Line 165, 166 and 167 in the setup.py file are:

165. sys.path.insert(0, "pysam")
 166. import version
 167.version = version.__version__

Unfortunatelly, my knowledge has taken me only this far. Is it necessary to modify the setup.py file?

My system specs:

  • Python 2.7.13 :: Anaconda, Inc.
  • CentOS release 6.5
  • Linux 2.6.32-431.20.5.el6.x86_64
1

There are 1 best solutions below

4
On BEST ANSWER

version.py is in path/to/pysam-master/pysam. The script uses the os-module to add the pysam directory to the working directory of the environment before importing:

sys.path.insert(0, "pysam")

So, this specific problem should be solved by replacing the "pysam" in

sys.path.insert(0, "pysam")

with the full path to the pysam-directory.