Search code examples
pythonsslpip

Could not find a version that satisfies the requirement seaborn (from versions: none)


When I normally tried installing some package such as seaborn (same thing for other packages), using the following command

(gan) # pip install seaborn

I get this error

WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1129)'))': /simple/seaborn/
Could not fetch URL https://pypi.org/simple/seaborn/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/seaborn/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1129)'))) - skipping
ERROR: Could not find a version that satisfies the requirement seaborn (from versions: none)
ERROR: No matching distribution found for seaborn

I figured this is probably due to the firewall preventing downloads from pypi, so added it as trusted-host (figured using question on stackoverflow) (tried running python3 at same time so that it does not conflict with python2),

(gan) # python3 -m pip install --trusted-host=pypi.org --trusted-host=files.pythonhosted.org seaborn

but still fails with this error.

ERROR: Could not find a version that satisfies the requirement seaborn (from versions: none)
ERROR: No matching distribution found for seaborn

EDIT:
As explained in this answer, I tried using

python3 -m pip install --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --upgrade pip

to upgrade pip, but it's already in the latest version.

Requirement already satisfied: pip in ./gan/lib/python3.9/site-packages (22.3.1)

Solution

  • All the answers didn't work for me, including links to previously answered questions UNTIL when i disabled my VPN and ran this code:

        pip3 install seaborn
    

    And voila! it worked. Seaborn got installed,I was able to connect to PyPI, no more timeouts and it recommended I upgrade pip to the latest version using the command:

        python.exe -m pip install --upgrade pip
    

    NB: I am using Pycharm on Windows 10.0 and was initially running on pip v22.3.1 and after upgrade, i was on v23.2.1