1

I am trying to get a repository from github to work on my Windows 10 machine. This repository requires a large number of packages. The IDE I use is Pycharm. Within pycharm, one is automatically prompted to install any packages via pip. However, when I press "install packages" or try to install any package individually via pip, the following error appears:

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

When trying to find a solution, I came across this solution. I succesfully opened the venv in PowerShell. The solution then proposes to use the following line:

https://bootstrap.pypa.io/get-pip.py | python

This, however, gives me another error as follows:

curl : The request was aborted: Could not create SSL/TLS secure channel. At line:1 char:1 + curl https://bootstrap.pypa.io/get-pip.py | python + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : InvalidOperation: (System.Net.HttpWebRequest:HttpWebRequest) [Invoke-WebRequest], WebExc eption + FullyQualifiedErrorId : WebCmdletWebResponseException,Microsoft.PowerShell.Commands.InvokeWebRequestCommand

I can not find any further solutions that can help me with this. If someone can help with a next step, that would be greatly appreciated. Thanks in advance.

Update I reinstalled python and everything fixed itself. I guess something broke when installing it the first time.

2 Answers2

0

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.

M. Davis
  • 96
  • 7
  • Do you by any chance know where exactly this should be downloaded? – Mark Marketing Dec 27 '18 at 13:37
  • https://bootstrap.pypa.io/get-pip.py - you had the link in your question :) – M. Davis Dec 27 '18 at 13:38
  • Ok, I downloaded the file by just copy pasting the text into a python file. However, when I execute it from powershell, I get the following error (repeated 5-6 times): c:\users\market~1\appdata\local\temp\tmpclgooo\pip.zip\pip\_vendor\urllib3\util\ssl_.py:160: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings – Mark Marketing Dec 27 '18 at 13:49
  • I am using python 2.7, by the way. As the repository has not been updated to work with python 3. – Mark Marketing Dec 27 '18 at 13:50
  • It seems like python is making https requests but not correctly verifying certificates. Try running "pip install urllib3[secure]". This includes only the required security packages for certificate verification. – M. Davis Dec 27 '18 at 13:57
  • From where should this be ran? – Mark Marketing Dec 27 '18 at 14:01
  • In your powershell window. But now that I think about it pip isnt installed so I dont think it will work. Can you try using the command prompt (cmd) instead of powershell? – M. Davis Dec 27 '18 at 14:03
  • Yes, both cmd and powershell both do not recognize pip. – Mark Marketing Dec 27 '18 at 14:06
0

The cause of the error curl : The request was aborted: Could not create SSL/TLS secure channel. is Powershell by default uses TLS 1.0 to connect to website, but website security requires TLS 1.2. You can change this behavior with running any of the below command to use all protocols. You can also specify single protocol.

[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls, [Net.SecurityProtocolType]::Tls11, [Net.SecurityProtocolType]::Tls12, [Net.SecurityProtocolType]::Ssl3
[Net.ServicePointManager]::SecurityProtocol = "Tls, Tls11, Tls12, Ssl3"

After running these command run https://bootstrap.pypa.io/get-pip.py | python, this will install it successfully.