pkg_resources.DistributionNotFound: The 'pip==1.5.4' distribution was not found and is required by the application [duplicate]
Asked Answered
P

3

3

Working on Ubuntu and Python 2.7.6, I am trying to use pip. When I type just pip followed by enter, I get:

File "/usr/local/bin/pip", line 5, in <module>
  from pkg_resources import load_entry_point
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3095, in  <module>
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3081, in _call_aside
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 3108, in _initialize_master_working_set
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 660, in _build_master
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 673, in _build_from_requirements
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 846, in resolve
pkg_resources.DistributionNotFound: The 'pip==1.5.4' distribution was not found and is required by the application
Permissible answered 26/7, 2016 at 10:47 Comment(1)
Usually the output of pip states where a requirement comes from. You should add the full output of pip (and format it as code).Pith
W
10

Updated for 2017 (Ubuntu 17)

sudo apt-get purge python-pip
wget https://bootstrap.pypa.io/get-pip.py
sudo python get-pip.py
pip --version
rm get-pip.py
Weakwilled answered 25/8, 2017 at 18:10 Comment(3)
I was trying to install grpc package using pip3 install grpc I had upgraded pip to pip3 recently. Once I inserted the above command to install grpc, it was throwing some errors from pip import main ImportError: cannot import name 'main' Then I tried this answer askubuntu.com/questions/969463/… : Dint work for me. After trying your suggestion on getting latest pip with python-ip not python3-pip it worked. with this I dont have to say pip3, i can just say pip.Cramoisy
pip --versionWeakwilled
Pip3 is technically not an upgrade to pip, it is a tool for the python3 language, and pip2 is a tool for the python2 language, so technically they are for different language versions and thus not an upgrade of each other. For example pip2 and pip3 can both be version 18Weakwilled
S
0

Faced the same problem with ubuntu 14.04 ,python2.7.6 and pip 1.5.4. I did this,

 sudo apt-get install --reinstall python2.7

To reinstall python (not necessary though)

 sudo apt-get purge python-pip

(removing python pip)

 wget https://raw.github.com/pypa/pip/master/contrib/get-pip.py

(download from this,this is upgraded version (9))

 sudo python get-pip.py
 sudo pip install package-name

This worked!

Sansom answered 6/11, 2016 at 3:45 Comment(1)
Works but out of date. Added a newer oneWeakwilled
M
-3

You could try the following command

$ hash -r

Millimicron answered 20/6, 2019 at 14:9 Comment(1)
And what is that supposed to do? Why would it help?Coaction

© 2022 - 2024 — McMap. All rights reserved.