0

Never had issues with pip until now. I am running Python 2.7 r27:82525 and pip 9.0.1 locally on Windows 7 64 bits. A virtual environment using the same Python version and pip 9.0.2 produces the same problem. No matter what package I tried to install, I always get the same URL fetching error:

Could not fetch URL https://pypi.python.org/simple/psutil/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/psutil/ (Caused by S
SLError(SSLError(1, '_ssl.c:499: error:1407742E:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert protocol version'),)) - skipping

I am also getting the urllib3 InsecurePlatformWarning everybody seems to have too, in case it is related.

I can install a wheel file without any issues. The problem is the connection to the repository it seems.

edit: I have updated pip to version 10.0.1 and OpenSSL for Windows but I am still having this problem. Using the --trusted-flag option does not help either.

dabadaba
  • 7,899
  • 15
  • 62
  • 126
  • 2
    Possible duplicate of [Not able to install Python packages \[SSL: TLSV1\_ALERT\_PROTOCOL\_VERSION\]](https://stackoverflow.com/questions/49768770/not-able-to-install-python-packages-ssl-tlsv1-alert-protocol-version) – phd Jul 02 '18 at 10:55
  • 1
    @phd all answers are for Linux – dabadaba Jul 02 '18 at 11:00
  • 1
    No, all answers are general. You have to upgrade OpenSSL, Python and pip. – phd Jul 02 '18 at 14:02
  • @phd turns out upgrading Python solved it, so it *is* a duplicate. But I can't seem to be able to close the question, is it possible? If not, just post "upgrade python" as an answer and I will accept it. – dabadaba Jul 04 '18 at 13:14
  • No need, just leave it alone. – phd Jul 04 '18 at 13:15

2 Answers2

0

Please Use:

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package_name>
quest
  • 2,397
  • 1
  • 11
  • 20
  • SSL errors from pip can be ignored by adding pypi.org and files.pythonhosted.org as trusted hosts. I had troubles with SSLError and doing the above fixed it. I wouldn't know in great depth how and why it is doing so. – quest Jul 02 '18 at 10:36
  • 1
    @PankajJoshi if you don't know "how and why" your "solution" fixed _your_ problem then you cannot know if it will fix the OP's problem too, so even if it accidentally happens to fix the issue, it's still a bad answer, as it is cargo cult rather than knowledge, and SO is about sharing knowledge. – bruno desthuilliers Jul 02 '18 at 11:19
  • This didn't work either. It's not going around the SSL, still getting the error. – dabadaba Jul 03 '18 at 13:55
0

The problem was that the Python version I was running was too old. Upgrading it to 2.7.14 solved it.

dabadaba
  • 7,899
  • 15
  • 62
  • 126