I am trying to install a Python library using pip
, getting an SSL error:
~/projects/base pre-master± pip install xdict
Collecting xdict
Could not fetch URL https://pypi.python.org/simple/xdict/: There was a problem confirming the ssl certificate: [SSL: TLSV1_ALERT_PROTOCOL_VERSION] tlsv1 alert protocol version (_ssl.c:590) - skipping
Could not find a version that satisfies the requirement xdict (from versions: )
No matching distribution found for xdict
pip version: pip 9.0.1
How do I fix this error?
This module provides access to Transport Layer Security (often known as “Secure Sockets Layer”) encryption and peer authentication facilities for network sockets, both client-side and server-side. This module uses the OpenSSL library.
Upgrade pip as follows:
curl https://bootstrap.pypa.io/get-pip.py | python
Note: You may need to use sudo python
above if not in a virtual environment.
(Note that upgrading pip
using pip
i.e pip install --upgrade pip
will also not upgrade it correctly. It's just a chicken-and-egg issue. pip
won't work unless using TLS >= 1.2.)
As mentioned in this detailed answer, this is due to the recent TLS deprecation for pip. Python.org sites have stopped support for TLS versions 1.0 and 1.1.
From the Python status page:
Completed - The rolling brownouts are finished, and TLSv1.0 and TLSv1.1 have been disabled. Apr 11, 15:37 UTC
For PyCharm (virtualenv) users:
Run virtual environment with shell. (replace "./venv/bin/activate" to your own path)
source ./venv/bin/activate
Run upgrade
curl https://bootstrap.pypa.io/get-pip.py | python
Restart your PyCharm instance, and check your Python interpreter in Preference.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With