4

I'm new to python and running the command:

pip install pysam

Which results in:

Collecting pysam
  Using cached https://files.pythonhosted.org/packages/25/7e/098753acbdac54ace0c6dc1f8a74b54c8028ab73fb027f6a4215487d1fea/pysam-0.15.4.tar.gz
    ERROR: Command errored out with exit status 1:
     command: 'c:\path\programs\python\python38\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\path\\Local\\Temp\\pip-install-qzuue1yz\\pysam\\setup.py'"'"'; __file__='"'"'C:\\path\\Temp\\pip-install-qzuue1yz\\pysam\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base pip-egg-info
    Complete output (23 lines):
    # pysam: cython is available - using cythonize if necessary
    # pysam: htslib mode is shared
    # pysam: HTSLIB_CONFIGURE_OPTIONS=None
    '.' is not recognized as an internal or external command,
    operable program or batch file.
    '.' is not recognized as an internal or external command,
    operable program or batch file.
      File "<string>", line 1, in <module>
      File "C:\path\Local\Temp\pip-install-qzuue1yz\pysam\setup.py", line 241, in <module>
        htslib_make_options = run_make_print_config()
      File "C:\path\\Local\Temp\pip-install-qzuue1yz\pysam\setup.py", line 68, in run_make_print_config
        stdout = subprocess.check_output(["make", "-s", "print-config"])
      File "c:\path\programs\python\python38\lib\subprocess.py", line 411, in check_output
        return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
      File "c:\path\programs\python\python38\lib\subprocess.py", line 489, in run
      File "c:\path\programs\python\python38\lib\subprocess.py", line 854, in __init__
        self._execute_child(args, executable, preexec_fn, close_fds,
      File "c:\path\programs\python\python38\lib\subprocess.py", line 1307, in _execute_child
        hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
    FileNotFoundError: [WinError 2] The system cannot find the file specified
    # pysam: htslib configure options: None
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

What is the problem here?

Originally I got an error about cython not being installed, so i ran pip install cython and that was able to run that without issue.

Kyle
  • 32,731
  • 39
  • 134
  • 184
  • Regarding the attempt at using Conda: I'm not sure about the package on PyPi, but bioconda doesn't appear to have a version of pysam for Python 3.8, at least on macOS. – AMC Feb 13 '20 at 01:07
  • note [this github issue](https://github.com/pysam-developers/pysam/issues/740) – FlyingTeller Feb 13 '20 at 09:04

2 Answers2

5

There are many binary wheels at PyPI but only for Linux and MacOS X. The package at bioconda is also compiled only for Linux and OS X.

When you try to install pysam at Windows pip downloads the source distribution pysam-0.15.4.tar.gz, unpacks it and runs setup.y

pysam's setup.py configures library htslib by running script htslib/configure. This is a shell script, it cannot be run in Windows without a Unix emulation layer. Hence the error.

Bottom line: like many pieces of software related to genetics (I have some experience with software written in Python and Java) pysam seems to be usable only on Unix, preferably Linux or OS X.

phd
  • 82,685
  • 13
  • 120
  • 165
  • Thanks, this is the correct answer. I'm on windows 10. Not looking forward to the nightmare that will be getting approval from security and IT corporate bureaucracy on getting approval for a linux dev environment and production server. – Kyle Feb 13 '20 at 18:21
  • 3
    My son, a young geneticist at a genetics lab at a large hospital uses Docker and WSL to work with Linux-only software. That's how I learned that most genetic-related software work only on Linux or MacOS X. – phd Feb 13 '20 at 18:25
  • Try WSL? https://github.com/pysam-developers/pysam/issues/575#issuecomment-468836983 – Nick W Nov 01 '22 at 14:48
1

if you have anaconda, try this:

conda install -c bioconda pysam

Sheets
  • 37
  • 1
  • 9
  • I do not at the moment, I'm just using Visual Studio Code. – Kyle Feb 12 '20 at 22:38
  • Anaconda is the 'installer'. Take a look here (https://stackshare.io/stackups/anaconda-vs-python) – Sheets Feb 12 '20 at 22:47
  • I tried installing Anaconda and PyCharm, and if i run `conda install -c bioconda pysam` it tells me `PackagesNotFoundError: The following packages are not available from current channels: - pysam ` – Kyle Feb 12 '20 at 23:09
  • @Kyle Is that the entire message? – AMC Feb 13 '20 at 01:03
  • https://anaconda.org/bioconda/pysam has packages for linux-64 and osx-64, no w64. – phd Nov 01 '22 at 15:13