Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ModuleNotFoundError: No module named 'pip.download' when trying to install Python package for Django

When trying to install Numpy and other packages using pip. I get a message saying ModuleNotFoundError: No module named 'pip.download'. Anyone know any possible solutions for this? I'm currently running on Python3. I've had a look at similar problems but no solutions seem to work. E.g. "pip install unroll": "python setup.py egg_info" failed with error code 1

pip3 install 'django-numpy==1.0'
Collecting django-numpy==1.0
  Downloading https://files.pythonhosted.org/packages/a2/15/22ea119379010455ee91c3ee2f76da207fbd342f5277305da3ad660a0a13/django-numpy-1.0.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/pz/d28llk412ss8ptwv5znkhv1m0000gn/T/pip-install-kwd6b6us/django-numpy/setup.py", line 6, in <module>
        from pip.download import PipSession
    ModuleNotFoundError: No module named 'pip.download'

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/pz/d28llk412ss8ptwv5znkhv1m0000gn/T/pip-install-kwd6b6us/django-numpy/
like image 703
Todd Drinkwater Avatar asked Sep 20 '18 21:09

Todd Drinkwater


People also ask

How do I fix No module named pip?

Solution Idea 1: Install Library pip Before being able to import the Pandas module, you need to install it using Python's package manager pip . Make sure pip is installed on your machine. This simple command installs pip in your virtual environment on Windows, Linux, and MacOS.

How do I manually install pip in Python?

Step 1: Download the get-pip.py (https://bootstrap.pypa.io/get-pip.py) file and store it in the same directory as python is installed. Step 2: Change the current path of the directory in the command line to the path of the directory where the above file exists. Step 4: Now wait through the installation process. Voila!


2 Answers

Pip version should be reduced to 9.0.1 pip install pip==9.0.1

like image 121
Oleh Pryshliak Avatar answered Sep 20 '22 11:09

Oleh Pryshliak


If you wish to update an old Python package using this code, from pip.download import PipSession, this snippet can replace it

try:  # pip >= 10
    from pip._internal.download import PipSession
except ImportError:  # pip <= 9.0.3
    from pip.download import PipSession

(derived from this similar answer: https://stackoverflow.com/a/49867265/148585)

like image 44
theY4Kman Avatar answered Sep 19 '22 11:09

theY4Kman