Pip install ssl error

I am very new to Python and trying to > pip install linkchecker on Windows 7. Some notes: pip install is failing no matter the package. For example, > pip install scrapy also results in the ...

I am very new to Python and trying to > pip install linkchecker on Windows 7. Some notes:

  • pip install is failing no matter the package. For example, > pip install scrapy also results in the SSL error.
  • Vanilla install of Python 3.4.1 included pip 1.5.6. The first thing I tried to do was install linkchecker. Python 2.7 was already installed, it came with ArcGIS. python and pip were not available from the command line until I installed 3.4.1.
  • > pip search linkchecker works. Perhaps that is because pip search does not verify the site’s SSL certificate.
  • I am in a company network but we do not go through a proxy to reach the Internet.
  • Each company computer (including mine) has a Trusted Root Certificate Authority that is used for various reasons including enabling monitoring TLS traffic to https://google.com. Not sure if that has anything to do with it.

Here are the contents of my pip.log after running pip install linkchecker:

Downloading/unpacking linkchecker
  Getting page https://pypi.python.org/simple/linkchecker/
  Could not fetch URL https://pypi.python.org/simple/linkchecker/: connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)
  Will skip URL https://pypi.python.org/simple/linkchecker/ when looking for download links for linkchecker
  Getting page https://pypi.python.org/simple/
  Could not fetch URL https://pypi.python.org/simple/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/ (Caused by <class 'http.client.CannotSendRequest'>: Request-sent)
  Will skip URL https://pypi.python.org/simple/ when looking for download links for linkchecker
  Cannot fetch index base URL https://pypi.python.org/simple/
  URLs to search for versions for linkchecker:
  * https://pypi.python.org/simple/linkchecker/
  Getting page https://pypi.python.org/simple/linkchecker/
  Could not fetch URL https://pypi.python.org/simple/linkchecker/: connection error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:598)
  Will skip URL https://pypi.python.org/simple/linkchecker/ when looking for download links for linkchecker
  Could not find any downloads that satisfy the requirement linkchecker
Cleaning up...
  Removing temporary dir C:UsersjcookAppDataLocalTemppip_build_jcook...
No distributions at all found for linkchecker
Exception information:
Traceback (most recent call last):
  File "C:Python34libsite-packagespipbasecommand.py", line 122, in main
    status = self.run(options, args)
  File "C:Python34libsite-packagespipcommandsinstall.py", line 278, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "C:Python34libsite-packagespipreq.py", line 1177, in prepare_files
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade)
  File "C:Python34libsite-packagespipindex.py", line 277, in find_requirement
    raise DistributionNotFound('No distributions at all found for %s' % req)
pip.exceptions.DistributionNotFound: No distributions at all found for linkchecker

Wai Ha Lee's user avatar

Wai Ha Lee

8,41977 gold badges60 silver badges90 bronze badges

asked Sep 22, 2014 at 19:25

Jeremy Cook's user avatar

5

pip install gensim config --global http.sslVerify false

Just install any package with the «config —global http.sslVerify false» statement

You can ignore SSL errors by setting pypi.org and files.pythonhosted.org as well as the older pypi.python.org as trusted hosts.

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

Note: Sometime during April 2018, the Python Package Index was migrated from pypi.python.org to pypi.org. This means «trusted-host» commands using the old domain no longer work, but you can add both.

Permanent Fix

Since the release of pip 10.0, you should be able to fix this permanently just by upgrading pip itself:

$ pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org pip setuptools

Or by just reinstalling it to get the latest version:

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

(… and then running get-pip.py with the relevant Python interpreter).

pip install <otherpackage> should just work after this. If not, then you will need to do more, as explained below.


You may want to add the trusted hosts and proxy to your config file.

pip.ini (Windows) or pip.conf (unix)

[global]
trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org

Alternate Solutions (Less secure)

Most of the answers could pose a security issue.

Two of the workarounds that help in installing most of the python packages with ease would be:

  • Using easy_install: if you are really lazy and don’t want to waste much time, use easy_install <package_name>. Note that some packages won’t be found or will give small errors.
  • Using Wheel: download the Wheel of the python package and use the pip command pip install wheel_package_name.whl to install the package.

Simon Sobisch's user avatar

answered Apr 20, 2015 at 15:13

Vaulstein's user avatar

VaulsteinVaulstein

19.2k7 gold badges47 silver badges70 bronze badges

41

Use the --cert argument:

You can specify a certificate with:

pip --cert <path/to/cert>.pem install <package list>

e.g.:

pip --cert /etc/ssl/certs/FOO_Root_CA.pem install linkchecker

See: Docs » Reference Guide » pip

If specifying your company’s root cert doesn’t work maybe the cURL one will work: http://curl.haxx.se/ca/cacert.pem

You must use a PEM file and not a CRT file. If you have a CRT file you will need to convert the file to PEM There are reports in the comments that this now works with a CRT file but I have not verified.

Also check: SSL Cert Verification.

Stabledog's user avatar

Stabledog

2,9712 gold badges31 silver badges41 bronze badges

answered Sep 26, 2014 at 14:59

Steve Tauber's user avatar

Steve TauberSteve Tauber

9,2115 gold badges41 silver badges46 bronze badges

11

For me the problem was fixed by creating a folder
pip, with a file: pip.ini
in
C:Users<username>AppDataRoaming
e.g:

C:Users<username>AppDataRoamingpippip.ini

Inside it I wrote:

[global]
trusted-host = pypi.python.org
               pypi.org
               files.pythonhosted.org

I restarted python, and then pip permanently trusted these sites, and used them to download packages from.

If you can’t find the AppData Folder on windows, write %appdata% in file explorer and it should appear.

answered Aug 24, 2018 at 14:24

Timo Kvamme's user avatar

Timo KvammeTimo Kvamme

2,6661 gold badge18 silver badges23 bronze badges

10

Permanent fix — pip config

I had ssl issues due to company network security related to netscope. My machine is windows 10 with python 3.9 and the following command worked for me.

pip config set global.trusted-host 
    "pypi.org files.pythonhosted.org pypi.python.org" 
    --trusted-host=pypi.python.org 
    --trusted-host=pypi.org 
    --trusted-host=files.pythonhosted.org

Here, pip permanently trusted these sites, and now we can use them to download any packages.

Gringo Suave's user avatar

Gringo Suave

29k6 gold badges85 silver badges75 bronze badges

answered Jun 1, 2021 at 22:42

nirojshrestha019's user avatar

7

kenorb’s answer is very useful (and great!).

Among his solutions, maybe this is the most simple one:
--trusted-host

For example, in this case you can do

pip install --trusted-host pypi.python.org linkchecker

The pem file(or anything else) is unnecessary.

Community's user avatar

answered Oct 24, 2016 at 7:50

plhn's user avatar

plhnplhn

4,8474 gold badges43 silver badges47 bronze badges

1

The answers are quite similar and a bit confusing. In my case, the certificates in my company’s network was the issue. I was able to work around the problem using:

pip install --trusted-host files.pythonhosted.org --trusted-host pypi.org --trusted-host pypi.python.org oauthlib -vvv

As seen here. The -vvv argument can be omited if verbose output is not required

answered May 7, 2018 at 21:39

Koji D'infinte's user avatar

1

Permanent Fix

pip install --upgrade pip --trusted-host pypi.org --trusted-host files.pythonhosted.org

For eg:

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

answered May 6, 2019 at 17:17

Devesh Sharma's user avatar

3

I tried majority of the solutions provided in this answer blog, however none of them worked, I had this ssl certificant error as I try to install python packages.

I succeed by following command:

python -m pip install PACKAGENAME --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org 

answered Oct 18, 2020 at 23:16

Weilory's user avatar

WeiloryWeilory

2,30614 silver badges28 bronze badges

2

The most straightforward way I’ve found, is to download and use the «DigiCert High Assurance EV Root CA» from DigiCert at https://www.digicert.com/digicert-root-certificates.htm#roots

You can visit https://pypi.python.org/ to verify the cert issuer by clicking on the lock icon in the address bar, or increase your geek cred by using openssl:

$ openssl s_client -connect pypi.python.org:443
CONNECTED(00000003)
depth=1 /C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA
verify error:num=20:unable to get local issuer certificate
verify return:0
---
Certificate chain
 0 s:/businessCategory=Private Organization/1.3.6.1.4.1.311.60.2.1.3=US/1.3.6.1.4.1.311.60.2.1.2=Delaware/serialNumber=3359300/street=16 Allen Rd/postalCode=03894-4801/C=US/ST=NH/L=Wolfeboro,/O=Python Software Foundation/CN=www.python.org
   i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA
 1 s:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert SHA2 Extended Validation Server CA
   i:/C=US/O=DigiCert Inc/OU=www.digicert.com/CN=DigiCert High Assurance EV Root CA

The last CN value in the certificate chain is the name of the CA that you need to download.

For a one-off effort, do the following:

  1. Download the CRT from DigiCert
  2. Convert the CRT to PEM format
  3. Export the PIP_CERT environment variable to the path of the PEM file

(the last line assumes you are using the bash shell) before running pip.

curl -sO http://cacerts.digicert.com/DigiCertHighAssuranceEVRootCA.crt 
openssl x509 -inform DES -in DigiCertHighAssuranceEVRootCA.crt -out DigiCertHighAssuranceEVRootCA.pem -text
export PIP_CERT=`pwd`/DigiCertHighAssuranceEVRootCA.pem

To make this re-usable, put DigiCertHighAssuranceEVRootCA.crt somewhere common and export PIP_CERT accordingly in your ~/.bashrc.

answered Feb 25, 2015 at 16:53

chnrxn's user avatar

chnrxnchnrxn

1,2991 gold badge16 silver badges16 bronze badges

2

To solve this problem once and for all, you can verify that you have a pip.conf file.

This is where your pip.conf should be, according to the documentation:

On Unix the default configuration file is: $HOME/.config/pip/pip.conf which respects the XDG_CONFIG_HOME environment variable.

On macOS the configuration file is $HOME/Library/Application Support/pip/pip.conf if directory $HOME/Library/Application Support/pip exists else $HOME/.config/pip/pip.conf

On Windows the configuration file is %APPDATA%pippip.ini.

Inside a virtualenv:

On Unix and macOS the file is $VIRTUAL_ENV/pip.conf

On Windows the file is: %VIRTUAL_ENV%pip.ini

Your pip.conf should look like:

[global]
trusted-host = pypi.python.org

pip install linkchecker installed linkchecker without complains after I created the pip.conf file.

Community's user avatar

answered Sep 25, 2017 at 17:23

Alex Fortin's user avatar

Alex FortinAlex Fortin

1,9761 gold badge18 silver badges27 bronze badges

5

You’ve the following possibilities to solve issue with CERTIFICATE_VERIFY_FAILED:

  • Use HTTP instead of HTTPS (e.g. --index-url=http://pypi.python.org/simple/).
  • Use --cert <trusted.pem> or CA_BUNDLE variable to specify alternative CA bundle.

    E.g. you can go to failing URL from web-browser and import root certificate into your system.

  • Run python -c "import ssl; print(ssl.get_default_verify_paths())" to check the current one (validate if exists).

  • OpenSSL has a pair of environments (SSL_CERT_DIR, SSL_CERT_FILE) which can be used to specify different certificate databasePEP-476.
  • Use --trusted-host <hostname> to mark the host as trusted.
  • In Python use verify=False for requests.get (see: SSL Cert Verification).
  • Use --proxy <proxy> to avoid certificate checks.

Read more at: TLS/SSL wrapper for socket objects — Verifying certificates.

answered Aug 24, 2016 at 13:30

kenorb's user avatar

kenorbkenorb

150k80 gold badges668 silver badges724 bronze badges

2

Set Time and Date correct!

For me, it came out that my date and time was misconfigured on Raspberry Pi. The result was that all SSL and HTTPS connections failed, using the https://files.pythonhosted.org/ server.

Update it like this:

sudo date -s "Wed Thu  23 11:12:00 GMT+1 2018"
sudo dpkg-reconfigure tzdata

Or directly with e.g. Google’s time:

Ref.: https://superuser.com/a/635024/935136

sudo date -s "$(curl -s --head http://google.com | grep ^Date: | sed 's/Date: //g')"
sudo dpkg-reconfigure tzdata

answered Aug 23, 2018 at 9:30

Thomas Devoogdt's user avatar

1

I recently ran into this problem because of my company’s web content filter that uses its own Certificate Authority so that it can filter SSL traffic. PIP doesn’t seem to be using the system’s CA certificates in my case, producing the error you mention. Downgrading PIP to version 1.2.1 presented its own set of problems later on, so I went back to the original version that came with Python 3.4.

My workaround is quite simple: use easy_install. Either it doesn’t check the certs (like the old PIP version), or it knows to use the system certs because it works every time for me and I can still use PIP to uninstall packages installed with easy_install.

If that doesn’t work and you can get access to a network or computer that doesn’t have the issue, you could always setup your own personal PyPI server: how to create local own pypi repository index without mirror?

I almost did that until I tried using easy_install as a last ditch effort.

Community's user avatar

answered Dec 23, 2014 at 15:17

Ross Peoples's user avatar

Ross PeoplesRoss Peoples

9032 gold badges13 silver badges20 bronze badges

2

TLDR:

pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r requirements.txt -vvv

pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org <packageName> -vvv

So, Having 30+ answers to the question already, but nothing was working for me in June 2020 (while in lockdown ).
all were given in different moments of past. I will try to make this answer work for all times in future.
The problem is while pip installs package it tries to connect with host URL where package is stored and doesn’t trust the URL while downloading it.

There are two ways we can solve this:
Easy and non-secure:
1. check which URL is hit by pip to download the package.

pip install <packageName> -vvv

if you will carefully check the output, you will see it might be going to some URL like pypi.org or may be pypi.python.org.

if it is, just add trusted host option to the command like below:

pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org <packageName> -vvv

or if you are using requirements file:

pip install --trusted-host pypi.org --trusted-host pypi.python.org --trusted-host files.pythonhosted.org -r requirements.txt -vvv

Secure way:

Go to each of these URL and download their public cert (just google how to download), create a chain, store it as .pem file and run below command:

pip --cert YourPemFile.pem install <packageName>

answered Jun 19, 2020 at 11:25

Nitesh chauhan's user avatar

You can try to bypass the SSL error by using http instead of https. Of course this is not optimal in terms of security, but if you are in a hurry it should do the trick:

pip install --index-url=http://pypi.python.org/simple/ linkchecker

answered Oct 3, 2014 at 13:01

Augusto Destrero's user avatar

Augusto DestreroAugusto Destrero

3,9251 gold badge22 silver badges25 bronze badges

10

You have 4 options:

Using a certificate as parameter

$ pip install --cert /path/to/mycertificate.crt linkchecker

Using a certificate in a pip.conf

Create this file:

$HOME/.pip/pip.conf (Linux)

%HOME%pippip.ini (Windows)

and add these lines:

[global]
cert = /path/to/mycertificate.crt

Ignoring certificate and using HTTP

$ pip install --trusted-host pypi.python.org linkchecker

Ignoring certificate and using HTTP in a pip.conf

Create this file:

$HOME/.pip/pip.conf (Linux)

%HOME%pippip.ini (Windows)

and add these lines:

[global]
trusted-host = pypi.python.org

Source

  • https://pip.pypa.io/en/latest/user_guide/#configuration

slm's user avatar

slm

14.9k12 gold badges106 silver badges120 bronze badges

answered Apr 20, 2018 at 15:44

Thiago Falcao's user avatar

0

I installed pip 1.2.1 with easy_install and upgraded to latest version of pip (6.0.7 at the time) which is able to install packages in my case.

easy_install pip==1.2.1
pip install --upgrade pip

answered Feb 4, 2015 at 14:20

theofanis's user avatar

theofanistheofanis

1191 silver badge3 bronze badges

1

The answers to use

pip install --trusted-host pypi.python.org <package>

work. But you’ll have to check if there are redirects or caches pip is hitting. On Windows 7 with pip 9.0.1, I had to run

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

You can find these with the verbose flag.

answered Apr 25, 2018 at 19:46

pmbotter's user avatar

pmbotterpmbotter

4631 gold badge6 silver badges7 bronze badges

First of all,

    pip install --trusted-host pypi.python.org <package name>

did not work for me. I kept getting the CERTIFICATE_VERIFY_FAILED error. However, I noticed in the error messages that they referenced the ‘pypi.org’ site. So, I used this as the trusted host name instead of pypi.python.org. That almost got me there; the load was still failing with CERTIFICATE_VERIFY_FAILED, but at a later point. Finding the reference to the website that was failing, I included it as a trusted host. What eventually worked for me was:

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

answered Apr 23, 2018 at 16:50

Pat B.'s user avatar

Pat B.Pat B.

3492 silver badges12 bronze badges

1

Don’t Skip! Found Safe Solution for Linux

All the solutions of adding pypi.org to trusted sites with --trusted-host is not safe, basically skipping https, not really fixing the problem.
Everyone which uses this approach, please try to update your cert this way and remove --trusted-host flag:

sudo yum -y update ca-certificates
export PIP_CERT=/etc/ssl/certs/ca-bundle.crt 

Safety Matters!

answered Oct 15, 2020 at 8:51

Ofek Hod's user avatar

Ofek HodOfek Hod

3,3742 gold badges12 silver badges25 bronze badges

1

Had the same problem trying pip install ftputil with ActivePython 2.7.8, ActivePython 3.4.1, and «stock» Python 3.4.2 on 64-bit Windows 7 Enterprise. All attempts failed with the same errors as OP.

Worked around the problem for Python 3.4.2 by downgrading to pip 1.2.1: easy_install pip==1.2.1 (see https://stackoverflow.com/a/16370731/234235). Same fix also worked for ActivePython 2.7.8.

The bug, reported in March 2013, is still open: https://github.com/pypa/pip/issues/829.

Community's user avatar

answered Oct 14, 2014 at 23:24

psteiner's user avatar

psteinerpsteiner

1873 silver badges17 bronze badges

2

I’m not sure if this is related, but I had a similar problem which was fixed by copying these files from Anaconda3/Library/bin to Anaconda3/DLLs :

libcrypto-1_1-x64.dll

libssl-1_1-x64.dll

answered May 12, 2019 at 20:25

ColdCold's user avatar

ColdColdColdCold

4,0812 gold badges24 silver badges20 bronze badges

2

I attempted with using the corporate proxy but it failed.

I’m using Python 3.6.

pip.conf file was missing.

Here are the steps to solve the issue:

  1. Install certificate package: -pip --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org install certifi

  2. Create a pip.conf file, as so:

     $ cd ~/.config 
     $ mkdir pip
     $ cd pip
     $ nano pip.conf

Add the following to the newly created .conf file, and save it.

[global]
trusted-host = pypi.python.org files.pythonhosted.org pypi.org pypi.io

All done and it started working.

Ian's user avatar

Ian

3,3763 gold badges26 silver badges59 bronze badges

answered Feb 12, 2021 at 5:22

Shabir's user avatar

ShabirShabir

971 silver badge7 bronze badges

1

Nothing on this page worked for me until I used the —verbose option to see that it wanted to get to files.pythonhosted.org rather than pypi.python.org:

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

So check the URL that it’s actually failing on via the —verbose option.

answered Apr 19, 2018 at 0:18

Dan Austin's user avatar

Dan AustinDan Austin

791 silver badge4 bronze badges

Short Solution:

easy_install <package name>

For Example:

easy_install pandas

Alternate solution:

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

Example:

pip install pandas --trusted-host pypi.org --trusted-host files.pythonhosted.org

answered Jan 23, 2020 at 12:58

Gil Baggio's user avatar

Gil BaggioGil Baggio

12.3k3 gold badges47 silver badges34 bronze badges

For Python 3.10

Add/update file with content

[global]
trusted-host = pypi.python.org
           pypi.org
           files.pythonhosted.org

file location

  1. MacOS — $HOME/Library/Application Support/pip/pip.conf

  2. Unix — $HOME/.config/pip/pip.conf

  3. Windows — %APPDATA%pippip.ini

answered Apr 4, 2022 at 12:28

Aniket Singh's user avatar

Aniket SinghAniket Singh

2,3241 gold badge20 silver badges31 bronze badges

Recently I faced the same issue in python 3.6 with visual studio 2015. After spending 2 days, I got the solution and its working fine for me.

I got below error while try to install numpy using pip or from visual studio
Collecting numpy
Could not fetch URL https://pypi.python.org/simple/numpy/: There was a problem confirming the ssl certificate: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:748) — skipping
Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy

Resolution :

For Windows OS

  1. open -> «%appdata%» Create «pip» folder if not exists.
  2. In pip folder create «pip.ini» file.
  3. Edit file and write
    [global]
    trusted-host = pypi.python.org
    Save and Close the file. Now install
    using pip/visual studio it works fine.

answered Sep 28, 2017 at 10:05

Ankit Raval's user avatar

One solution (for Windows) is to create a file called pip.ini on the %AppData%pip folder (create the folder if it doesn’t exist) and insert the following details:

[global]
cert = C:/certs/python_root.pem
proxy = http://my_user@my_company.com:my_password@proxy_ip:proxy_port

…and then we can execute the install instruction:

pip3 install PyQt5

Another option is to install the package using arguments for the proxy and certificate…

$ pip3 install --proxy http://my_user@my_company.com:my_password@proxy_ip:proxy_port 
   --cert C:/certs/python_root.pem PyQt5

To convert the certificate *.cer files to the required *.pem format execute the following instruction:

$ openssl x509 -inform der -in python_root.cer -out python_root.pem

Hope this helps someone!

slm's user avatar

slm

14.9k12 gold badges106 silver badges120 bronze badges

answered Apr 17, 2018 at 10:41

Marco's user avatar

MarcoMarco

2,3952 gold badges24 silver badges15 bronze badges

2

In my case it was due to SSL certificate being signed by internal CA of my company. Using workarounds like pip --cert did not help, but the following package did:

pip install pip_system_certs

See: https://pypi.org/project/pip-system-certs/

This package patches pip and requests at runtime to use certificates from the default system store (rather than the bundled certs ca).

This will allow pip to verify tls/ssl connections to servers who’s cert is trusted by your system install.

Community's user avatar

answered May 22, 2019 at 10:02

0x416e746f6e's user avatar

0x416e746f6e0x416e746f6e

9,7225 gold badges38 silver badges65 bronze badges

5

Just putting this here as I don’t see any other mentioning it.

You can set globally trusted-host to pip like this:

py -m pip config set global.trusted-host pypi.org

and most importantly, it will return the right place where the pip.ini/pip.conf is put

answered Apr 21, 2021 at 18:35

LionH's user avatar

LionHLionH

1646 bronze badges

Learning_Python_RequestsScripts>pip install requests
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting requests
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

(Learning_Python_Requests) C:UserseriklOneDriveDesktopPython_ScriptsLearning_Python_RequestsScripts>pip --version
pip 10.0.1 from c:userseriklonedrivedesktoppython_scriptslearning_python_requestslibsite-packagespip (python 3.7)

(Learning_Python_Requests) C:UserseriklOneDriveDesktopPython_ScriptsLearning_Python_RequestsScripts>pip install requests --trusted-host pypi.org --trusted-host files.pythonhosted.org
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting requests
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/requests/
  Could not fetch URL https://pypi.org/simple/requests/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/requests/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement requests (from versions: )
No matching distribution found for requests
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

I had similar error messages due to our corporate firewall intercepting SSL (i.e. a transparent SSL proxy). I exported the root CA cert that signs the firewall certificate in .pem format and appended it to the following file:

C:Python27Libsite-packagespip_vendorrequestscacert.pem

That resolved my issue. Your issue might not be exactly the same, but if you get the right CA certificates into the above cacert.pem I’m sure you can get passed your SSL certificate verification failure.

Stevoisiak's user avatar

Stevoisiak

13k36 gold badges96 silver badges150 bronze badges

answered Apr 28, 2014 at 14:32

Craig's user avatar

CraigCraig

1313 bronze badges

3

If pip complains about Certificate errors, then add some hosts to pip.ini.
Unfortunately Python 3.x on Win10 does not have any pip.ini file,
so you have to create it manually from powershell/cmd with:

  • mkdir C:ProgramDatapip

  • Create a file C:ProgramDatapippip.ini with notepad:

      [global]
      trusted-host = pypi.org (new-line)
                     files.pythonhosted.org
    

Check it with pip config -v list. You should see this in the last line:

global.trusted-host='pypi.orgnfiles.pythonhosted.org'

The n denotates a new-line that should be part of the trusted-host entry.

zx485's user avatar

zx485

2,17011 gold badges16 silver badges23 bronze badges

answered Jul 17, 2020 at 15:17

Robert Szabo's user avatar

2

Add this to your pip config, which on Windows is C:Users<user>pippip.ini.

[global]
  trusted-host = pypi.python.org
  proxy = <proxy>:<port>

Find your proxy by following these directions.

answered Dec 22, 2017 at 23:45

cmo's user avatar

0

I had the same problem, it was because my antivirus (Eset «Smart Security») was filtering SSL/TLS. Disabled that and everything was perfect.

answered Aug 30, 2019 at 18:45

Slm Coding's user avatar

When I’m trying to install PIP using the downloaded package from bootstrap.pypa.io, I’m getting SSL Certificate error. I’ve followed other posts and tried doing this by disabling the certificate check in /etc/python/cert-verification.cfg and tried using PYTHONHTTPSVERIFY=0 but this doesn’t seem to work and finally I have decided to ask this questions because other posts don’t really help my case.

I have the following Environment:

OS: centos-release-7-5.1804.1.el7.centos.x86_64

Python Packages:

[root@localhost ~]# yum list installed|grep python
dbus-python.x86_64                    1.1.1-9.el7                    @anaconda
libselinux-python.x86_64              2.5-12.el7                     @anaconda
newt-python.x86_64                    0.52.15-4.el7                  @anaconda
python.x86_64                         2.7.5-69.el7_5                 @updates
python-backports.x86_64               1.0-8.el7                      @base
python-backports-ssl_match_hostname.noarch
python-configobj.noarch               4.7.2-7.el7                    @anaconda
python-decorator.noarch               3.4.0-3.el7                    @anaconda
python-firewall.noarch                0.4.4.4-14.el7                 @anaconda
python-gobject-base.x86_64            3.22.0-1.el7_4.1               @anaconda
python-iniparse.noarch                0.4-9.el7                      @anaconda
python-ipaddress.noarch               1.0.16-2.el7                   @base
python-libs.x86_64                    2.7.5-69.el7_5                 @updates
python-linux-procfs.noarch            0.4.9-3.el7                    @anaconda
python-perf.x86_64                    3.10.0-862.9.1.el7             @updates
python-pycurl.x86_64                  7.19.0-19.el7                  @anaconda
python-pyudev.noarch                  0.15-9.el7                     @anaconda
python-schedutils.x86_64              0.4-6.el7                      @anaconda
python-setuptools.noarch              0.9.8-7.el7                    @base
python-slip.noarch                    0.4.0-4.el7                    @anaconda
python-slip-dbus.noarch               0.4.0-4.el7                    @anaconda
python-urlgrabber.noarch              3.10-8.el7                     @anaconda
python-wheel.noarch                   0.24.0-2.el7                   @epel
rpm-python.x86_64                     4.11.3-32.el7                  @anaconda

Following are the steps and Errors:

[root@localhost ~]# curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1604k  100 1604k    0     0  73257      0  0:00:22  0:00:22 --:--:-- 72502
[root@localhost ~]#

[root@localhost ~]# PYTHONHTTPSVERIFY=0 python get-pip.py
Collecting pip
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),)': /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/5f/25/e52d3f31441505a5f3af41213346e5b6c221c9e086a166f3703d2ddaf940/pip-18.0-py2.py3-none-any.whl (Caused by SSLError(SSLError(1, u'[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:579)'),))

I would like to add, Python was pre-installed with the OS and I’m trying to install PIP directly. I tried installed from epel-repo but I get a older version and when I try to update it (because without update, I keep getting error for installing the new version of PIP) I get the same error.

Could anyone suggest how to get this fixed?

Понравилась статья? Поделить с друзьями:
  • Php fatal error class imagick not found
  • Pip install r requirements txt ошибка
  • Php fatal error cannot use object of type stdclass as array in
  • Pip install pycurl error windows
  • Php fatal error call to undefined function curl init