9

I am not able to install any external python module through pip install. I have installed python correctly but if I use pip_install it shows me this error.

Here is the code after I run the pip install pytesseract

 C:\Users\190560>pip install pytesseract
Collecting pytesseract
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pytesseract/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pytesseract/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pytesseract/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pytesseract/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)': /simple/pytesseract/
  Could not fetch URL https://pypi.org/simple/pytesseract/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pytesseract/ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)) - skipping
  Could not find a version that satisfies the requirement pytesseract (from versions: )
No matching distribution found for pytesseract
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:833)'),)) - skipping

How do I solve this problem??

I can partially solve the problem by using this command

pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org <package_name>

but I cannot find any pip.ini folder on my computer as suggested by this question here

Any suggestions to fix this problem permanently??

Yash Soni
  • 294
  • 2
  • 4
  • 12
  • Are you working within a corporate network? – srj Jun 21 '18 at 05:08
  • @srj No i am not using any corporate network!! – Yash Soni Jun 21 '18 at 05:24
  • There are a few different things that can cause this. First, see [this question](https://stackoverflow.com/questions/25981703/). Do what the answer says to `install -U pip setuptools`. If that works, see if `pip` now works without the `trusted-host` stuff. If so, that was your problem. If not, you need to give u more information: what platform you're on, what Python version and how you installed it (python.org installer, apt-get, whatever), which of those steps failed, and what the output was. – abarnert Jun 21 '18 at 05:37
  • @abarnert I am using windows 10 platform and I am using the latest version of python which is python 3.6.5. I installed it through the python.org installer. The only step in which I failed is the one I mentioned above and the error is also specified. – Yash Soni Jun 21 '18 at 05:59
  • Did you do the `pip install --trusted-host ` with `-U pip setuptools`? In at least some cases, that's how you turn the temporary/partial solution into the permanent fix, which is why I asked you to do that. – abarnert Jun 21 '18 at 06:01
  • @dsgdfg Why did you just post a link to the same question that's already linked, and that the OP is already talking about? – abarnert Jun 21 '18 at 06:02
  • 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 Jun 21 '18 at 13:32

4 Answers4

14

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

Wang Gang
  • 168
  • 1
  • 4
1

Once I struggled a lot for 3 days ,Nothing worked then I found this solution.

Possible solution is to instruct Python to use your Windows Certificate Store instead of the built-in store in the certifi package. You can do that by installing python-certifi-win32:

pip install python-certifi-win32

Then python will going to be use the same certificates as your browsers do.

0

I had a similar problem and found out to be related to the network IPv6 address. I do not know why. What solved my problem was to disable the IPv6. You can find how to do it here for Windows and MacOS X.

y.luis.rojo
  • 1,794
  • 4
  • 22
  • 41
0

On Windows, if using a proxy, temporarily disable it in Control Panel - Internet Options - Connection - LAN settings.

Or permanently bypass proxy (also there in LAN settings) for pypi.org;files.pythonhosted.org

LAN settings - exceptions pypi.org;files.pythonhosted.org

rustyx
  • 80,671
  • 25
  • 200
  • 267