Downgrading pip fails on virtualenv

I'm working on Ubuntu 16.04 with python2.7 virtualenv (version 15.0.1). When I create a new virtualenv it automatically installs pip (version 8.1.1). I want to downgrade pip to version 8.0.2 but when running

pip install pip==8.0.2

I get the following error:

Exception:
Traceback (most recent call last): File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/basecommand.py", line 209, in main status = self.run(options, args) File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/commands/install.py", line 328, in run wb.build(autobuilding=True) File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/wheel.py", line 748, in build self.requirement_set.prepare_files(self.finder) File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/req/req_set.py", line 360, in prepare_files ignore_dependencies=self.ignore_dependencies)) File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/req/req_set.py", line 448, in _prepare_file req_to_install, finder) File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/req/req_set.py", line 387, in _check_skip_installed req_to_install.check_if_exists() File "/mnt/code/.venvs/bla/local/lib/python2.7/site-packages/pip/req/req_install.py", line 1011, in check_if_exists self.req.project_name
AttributeError: 'Requirement' object has no attribute 'project_name'

However, running it outside the virtualenv works.

Does anyone know a solution to this problem?

The reason I want to downgrade the pip version is because the newer version converts dots (.) to dashes (-) when searching for packages, and it doesn't find some of the packages I need.

2 Answers

Take a look at this discussion.

O.K, so I saw that in pip 8.1.1, in the file req_install.py, the check_if_exists function tries to access self.req.project_name when req has an attribute called "name" and not "project_name". In pip 8.1.2 this is changed to "name". So what I did is upgraded to pip 8.1.2 using pip install pip --upgradeand then downgraded to 8.0.2 using pip install pip==8.0.2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like