Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

How to solve ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443) with pip?

Ask Question

I also tried by writin sudo before them but all it came up with the following errors in red lines:

Exception:
Traceback (most recent call last):
  File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
    status = self.run(options, args)
  File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 290, in run
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle)
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1198, in prepare_files
    do_download,
  File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1376, in unpack_url
    self.session,
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 572, in unpack_http_url
    download_hash = _download_url(resp, link, temp_location)
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 433, in _download_url
    for chunk in resp_read(4096):
  File "/usr/lib/python2.7/dist-packages/pip/download.py", line 421, in resp_read
    chunk_size, decode_content=False):
  File "/usr/lib/python2.7/dist-packages/urllib3/response.py", line 256, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/lib/python2.7/dist-packages/urllib3/response.py", line 201, in read
    raise ReadTimeoutError(self._pool, None, 'Read timed out.')
ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.
Storing debug log for failure in /root/.pip/pip.log'
                I think it's network problem try ping pypi.python.org see if it works. It can be solved with something as simple as restarting your router or reconnecting to your internet or even just trying again after sometime. please follow How to ask before posting here.
– Krishna Chaitanya Kornepati
                Apr 8, 2017 at 18:39
                Avoid blindly using sudo to try magically try fix things when you aren't sure it's a permissions issue. It rarely will make things just work, but can mess up your permissions, which can cause you very annoying future issues. Only use sudo when you know it's needed.
– aggregate1166877
                Mar 16 at 13:00
                Alternatively, I used export PIP_DEFAULT_TIMEOUT=100 since I had the pip command in a shared Dockerfile and it was a temporary requirement for me. But it works, thanks!
– Kerem
                Nov 15, 2017 at 12:15
                Thanks, It saves me in slow internet condition. I guess 100 is the the number of seconds pip'll wait for the reconnect after losing connection?
– Khanh Le
                Nov 17, 2017 at 7:15
                I cannot find the setting with pip help or pip install help. There is howerver socket timeout. I wonder what is the default value?
– Timo
                Mar 30, 2018 at 8:10
                I cannot find the setting with pip help or pip install help. There is howerver socket timeout. I wonder what is the default value?
– Timo
                Mar 30, 2018 at 8:10

If you are using JetBrains PyCharm, the appropriate solution steps are :

  • connect to terminal/open terminal in PyCharm.

  • type source <path to your projects environment eg: /users/name/myapp/venv>

  • Run pip install <package name> or run pip3 install <package name> as per your installation

    This will automatically install package for your interpreter.

  •