Python3 pip3 install broken on Ubuntu

13,697

Solution 1

This has happened to me multiple times before. A lot of the time, pip3 has issues installing with python3 by default, so try uninstalling and reinstalling pip3. Hope this works.

sudo apt-get remove python3-pip; sudo apt-get install python3-pip

EDIT: After doing some scouting about pip.vendor.requests, it seems like this is a very common error relating to SSL problems. If this line gives you errors in python (import ssl), some solutions can be found here: https://github.com/pypa/pip/issues/2345.

Solution 2

Here, trying this method: https://pip.pypa.io/en/stable/installing/#installing-with-get-pip-py

# sudo python3 get-pip.py

Solution 3

This worked for me.

First remove your python3-pip:

sudo apt remove python3-pip

Then do this:

sudo apt install --purge python3-setuptools

And finally:

sudo apt install python3-pip
Share:
13,697
mlpy
Author by

mlpy

Updated on June 23, 2022

Comments

  • mlpy
    mlpy almost 2 years

    I installed python3 and pip3 successfully on my Ubuntu16.04, but pip3 install is broken. How can I fix this problem? The error info of pip3 install is as follows:

    # pip3 install xlwt
    Traceback (most recent call last):
    File "/usr/bin/pip3", line 9, in <module>
      from pip import main
    File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
      from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
    ModuleNotFoundError: No module named 'pip._vendor.requests'
    

    Output of "which pip3" and "pip3 --version":

    # which pip3
    /usr/bin/pip3
    
    # pip3 --version
    Traceback (most recent call last):
      File "/usr/bin/pip3", line 9, in <module>
        from pip import main
      File "/usr/lib/python3/dist-packages/pip/__init__.py", line 21, in <module>
        from pip._vendor.requests.packages.urllib3.exceptions import DependencyWarning
    ModuleNotFoundError: No module named 'pip._vendor.requests'
    

    p.s. Python2 pip runs successfully. Output of "which pip" and "pip --version":

    # which pip
    /usr/bin/pip
    
    # pip --version
    pip 1.5.4 from /usr/local/lib/python2.7/dist-packages/pip-1.5.4-py2.7.egg (python 2.7)
    

    And python and python3 installation information:

    # which python
    /usr/bin/python
    # which python3
    /usr/bin/python3
    
    # python -V
    Python 2.7.14
    # python3 -V
    Python 3.6.3
    

    Any solution or clue will be appreciated! Thank you!