pip connection failure: cannot fetch index base URL http://pypi.python.org/simple/
I know this is an old thread, but I encountered this issue today and wanted to share my solution to the problem because I haven't seen this solution elsewhere on SO.
My environment: Python 2.7.12/2.7.14 on Ubuntu 12.04.5 LTS in a virtualenv, pip version 1.1.
My Errors:
pip install nose
in console:
Cannot fetch index base URL http://pypi.python.org/simple/
in ~/.pip/pip.log:
Could not fetch URL http://pypi.python.org/simple/: HTTP Error 403: SSL is required
Curious for me because I had been running these same commands in a script without issue for about a year.
this fixed it:
pip install --index-url=https://pypi.python.org/simple/ nose
(note the https)
Hope this helps someone!
You need to upgrade your pip installation because it is still using http
instead of https
.
The --index-url
(short version: -i
) option allows you to specify an index-url in the call to pip itself, there you can use the https-variant. Then you can instruct pip to upgrade itself.
sudo pip install --index-url https://pypi.python.org/simple/ --upgrade pip
Afterwards you should be able to use pip without the --index-url
option.
I believe that the release 7.0.0 (2015-05-21) triggered this issue. The release note for that version states the following:
BACKWARD INCOMPATIBLE No longer implicitly support an insecure origin origin, and instead require insecure origins be explicitly trusted with the
--trusted-host
option.
You can check your pip version with pip --version
.
This would mean that issuing sudo pip install --trusted-host --upgrade pip
once would also solve this issue, albeit download pip over insecure http. This might also not work at all, because it is possible that the insecure endpoint is no longer accessible on the server (I have not tested this).