2

Hi I am having trouble install scanpy library using pip. Here's the command I ran

pip install scanpy

During the installation it reports the following error message:

Collecting scanpy
  Downloading https://files.pythonhosted.org/packages/78/cf/b2cc01e9c33613d738c1cdeb5af7d250cf965bda187aa258e45ed25a6a15/scanpy-1.3.1.tar.gz (216kB)
     |████████████████████████████████| 225kB 786kB/s 
    ERROR: Command errored out with exit status 1:
     command: /home/john/Desktop/env2/bin/python2 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-vIOr01/scanpy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-vIOr01/scanpy/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 /tmp/pip-install-vIOr01/scanpy/pip-egg-info
         cwd: /tmp/pip-install-vIOr01/scanpy/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-vIOr01/scanpy/setup.py", line 2, in <module>
        from pathlib import Path
    ImportError: No module named pathlib
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

2 Answers2

4

I think you might have ran the installation using python 2 which has been depreciated since the beginning of 2020. Have you tried running the installation for python 3 using the pip3 command instead?

pip3 install scanpy
Chrollo
  • 41
  • 1
1

Try running the command again with pip3. If that doesn't work, then you need to make sure you have Python 3 installed and are using the corresponding version of Pip. This excellent answer has detailed explanations of how to go about upgrading if you're having difficulty.

David Greydanus
  • 2,290
  • 1
  • 20
  • 40