Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

python - pip is not working after upgrade

Tags:

I tried upgrade pip3 with this command:

sudo pip3 install --upgrade pip

but unfortunately it doesn't work anymore and shows this message:

pip3 --version

message:

Traceback (most recent call last):
File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 651, in _build_master ws.require(requires)
File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 952, in require needed = self.resolve(parse_requirements(requirements))
File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 844, in resolve raise VersionConflict(dist, req).with_context(dependent_req) pkg_resources.VersionConflict: (pip 7.1.2 (/usr/local/lib/python3.4/dist-packages), Requirement.parse('pip==1.5.6'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/local/bin/pip3", line 5, in from pkg_resources import load_entry_point
File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 3084, in @_call_aside
File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 3070, in _call_aside f(*args, **kwargs)
File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 3097, in _initialize_master_working_set working_set = WorkingSet._build_master()
File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 653, in _build_master return cls._build_from_requirements(requires)
File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 666, in _build_from_requirements dists = ws.resolve(reqs, Environment())
File "/usr/local/lib/python3.4/dist-packages/pkg_resources/init.py", line 839, in resolve raise DistributionNotFound(req, requirers) pkg_resources.DistributionNotFound: The 'pip==1.5.6' distribution was not found and is required by the application

How to fix it?

like image 227
Shervin Gharib Avatar asked Sep 14 '15 12:09

Shervin Gharib


People also ask

Does upgrading pip upgrade Python?

Many users question exactly just how to upgrade to the latest version of PIP, given the ever-evolving and fast-moving python ecosystem. The short answer is, pip is just like any other PyPI package and you can upgrade it to newer (or downgrade to older) versions, just as you would upgrade or downgrade any other package.

How do I install pip update?

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.


1 Answers

It seems like you don't use virtualenv and your pythons/paths are probably messed up. I faced with similar problem with python-2.7 and -3.4 on Ubuntu 14.04. I tried

sudo python -m pip install --upgrade --force-reinstall pip

for 2.7 and it helped. Then I reinstalled pip for python-3.4 via easy_install3.

like image 194
Sergei Nikiforov Avatar answered Nov 24 '22 12:11

Sergei Nikiforov