'Pip Install Package Error: Could not install packages due to an OSError

I am getting the following error whenever I try to execute pip install [any package name]:

ERROR: Could not install packages due to an OSError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/31/58/d97b7af5302e63bfb3881931fda4aaacbbdcbc31257f983c06703d304c1e/streamlit_chat-0.0.2.1-py3-none-any.whl (Caused by ConnectTimeoutError(<pip._vendor.urllib3.connection.HTTPSConnection object at 0x00000228C6A15340>, 'Connection to files.pythonhosted.org timed out. (connect timeout=15)'))

I have already tried the following solution that I found on stack, but it doesn't work and I get the same error:

  • pip install --trusted-host=pypi.python.org --trusted-host=pypi.org --trusted-host=files.pythonhosted.org --upgrade --proxy=http://127.0.0.1:3128 [package name]

  • pip install --trusted-host pypi.python.org --trusted-host files.pythonhosted.org --trusted-host pypi.org [package name]

I use a windows system and sublime as my regular coding environment.



Solution 1:[1]

It can happen due network firewall settings, try to connect to other network and then run the command. Worked for me.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nikita