Not able to install Python packages [SSL: TLSV1_ALERT_PROTOCOL_VERSION]
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.
python - Can't install packages (in venv via Powershell)
This seems like it is an issue with Powershell downloading the package.
Try:
- downloading get-pip.py via your web browser
- navigating in Powershell to the directory you downloaded get-pip.py to
running;
python get-pip.py
This should install pip. If you can't download packages via pip once installed it is likely there is either a connection issue between you and pypi.org or between powershell and your outgoing connection.
Pip SSL Error on Windows
What ended up working for me is to add all the domains that are part of the new pypi routing.
pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org <package>
Which can also be setup in a pip.ini file.
pip install fail with SSL certificate verify failed (_ssl.c:833)
I have experienced similar issues when I am in a corporate network where a proxy is required for external network access. In this case, we'll have to tell pip the proxy:
pip --proxy=http://your.corporate.proxy.com install pytesseract
Another possible cause is due to the pypi domain change. In this case, you can try the solution as below:
pip --index-url=http://pypi.python.org/simple/ --trusted-host pypi.python.org install pytesseract
Another similar case with an excellent answer: pip always fails ssl verification
Related Topics
Understanding the "Is" Operator
How to Check If a String Represents an Int, Without Using Try/Except
What Is the Result of % in Python
How to Pass a String into Subprocess.Popen (Using the Stdin Argument)
Choosing the Correct Upper and Lower Hsv Boundaries For Color Detection With'Cv::Inrange' (Opencv)
How to Update a Plot in Matplotlib
Typeerror: 'List' Object Is Not Callable in Python
Using Both Python 2.X and Python 3.X in Ipython Notebook
Variable Scopes in Python Classes
Tkinter: How to Use After Method
How to Schedule Updates (F/E, to Update a Clock) in Tkinter
Parse Date String and Change Format
Is Explicitly Closing Files Important
Multiple Aggregations of the Same Column Using Pandas Groupby.Agg()