pythonlinuxanacondacondapysam

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


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:


Solution

  • 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.