pip install pandas failed because of environment error

Viewed 23237

I'm trying to install pandas but I'm getting this error:

Collecting pandas

Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl 
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl 
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl 
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl 
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)")': /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl 
Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/26/fc/d0509d445d2724fbc5f9c9a6fc9ce7da794873469739b6c94afc166ac2a2/pandas-0.23.4-cp37-cp37m-win32.whl (Caused by ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. (read timeout=15)"))

I am running on the command prompt as an admin and I am typing in pip install pandas. I have pip version 18.1. I have also tried running this on the Windows PowerShell within the scripts directory for python.

I have never had an issue installing a package before.

What is the error caused by and how do I fix it?

5 Answers

Looks like you're trying to install on a corporate network with a firewall in place, can you connect to another WiFi or hot spot and try downloading again?

It seems that you have slow connection to the server. Try increasing the timeout:

sudo pip install --default-timeout=120 pandas

Alternatively, you may use:

export PIP_DEFAULT_TIMEOUT=120

This is the amount of time (in seconds) pip will wait before deciding that the connection timed out (now it's 15 seconds in your case - "read timeout=15")

If you are logged as Administrator user and still facing this issue. There could be three reasons:

  1. Your machine/company's firewall is not allowing you to install/upgrade any module. (Contact support department).
  2. The WiFi is slow. (Fix is mentioned by other users).
  3. Sounds silly but most common reason, you have not rebooted the machine after installing Python on the guest.(Try rebooting).

Let me know if it helped you or anyone reading this comment.

Configure pip to trust the files.pythonhosted.org host:

pip config set --user global.trusted-host files.pythonhosted.org

You should then be able to perform the install.

FIXED --> ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: <...> (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:997)'))) Steps:

  1. Disconnect from VPN client
  2. Re-issue CMD command> pip install robotframework ... Successfully installed pip-21.3.1
Related