pip: Getting ssl certificate errors while using command pip3 install
Description
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 tried adding trusted host and the trusted host command but nothing seems to work for me on centos 7.9 also tried adding trusted host in pip.ini file tried with python 3.10 as well
Expected behavior
No response
pip version
pip-21.2.4
Python version
3.101.2 , 3.11
OS
centos 7.9
How to Reproduce
- install python on centos 7 using this link https://linuxstans.com/how-to-install-python-centos/
- then use command pip3.11 install unittest-xml-reporting
- it throws warnings and error
- anything with pip install is not working
Output
[root@localhost Documents]# python3.10 -m pip install -U pip
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Requirement already satisfied: pip in /usr/local/lib/python3.10/site-packages (21.2.4)
WARNING: 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/pip/
WARNING: 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/pip/
WARNING: 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/pip/
WARNING: 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/pip/
WARNING: 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/pip/
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
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
WARNING: 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
Code of Conduct
- I agree to follow the PSF Code of Conduct.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 23 (4 by maintainers)
I met the same error, and resolved it by below steps:
./configureandmake:make:Hello, I have the same problem when trying to use pip, but in my case I don’t have the warning “WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.”. I have:
I am using python 3.8 and if I try run python3.8 -c “import ssl” just works fine. What else could be this problem?
Getting below error for installing pip with 22.0.1 from python 3.9.
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 ERROR: Could not find a version that satisfies the requirement pip==22.0.1 (from versions: none) ERROR: No matching distribution found for pip==22.0.1
Solution: pip requires OpenSSL to be installed on the machine. If it is not installed then we get the above error.
Try Installing OpenSSL 1.1.1g with below steps:
Run wget with the URL to download the file.
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gzConfirm the file’s integrity by downloading the SHA256 file on the same page next to it.
wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz.sha256View the checksum to confirm the version you downloaded is safe to use.
sha256sum openssl-1.1.1g.tar.gzddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46 openssl-1.1.1g.tar.gzcat openssl-1.1.1g.tar.gz.sha256ddb04774f1e32f0c49751e21b67216ac87852ceb056b75209af2443400636d46 If they match, proceed with the next step.Decompress this file.
tar zxvf openssl-1.1.1g.tar.gzChange into the new openssl directory
cd openssl-1.1.1gConfigure openssl:
./config --prefix=/home/username/openssl --openssldir=/home/username/openssl no-ssl2provide your username in /home/username/opensslRun make. Once that is finished, run make test:
makemake testAt the end, you should see All tests successful.Run make install
make installChange back to your [home directory]
cd ~Add the following lines to your .bash_profile.
In the last line, make sure to change username to your [Shell user].
Update the .bash_profile.
. ~/.bash_profileTest to confirm it’s installed in the correct location and that the version is 1.1.1.
which openssl/home/username/openssl/bin/opensslopenssl versionOpenSSL 1.1.1g 21 Apr 2020Then try installing pip using below command
python -m pip install -U pipThe following solved the problem on my Mac:
brew install openssl@1.1Had this same problem, after updating my system (Manjaro linux). Before that I had no such issue. I already had openssl 3.0.7 butI had to also install the openssl-1.1 package to get it working again
Turn off VPN is work
Thanks! That solved the issue for me. Also running Manjaro.