Why Is Pip3 Throwing Error While Installing Packages?

Why Is Pip3 Throwing Error While Installing Packages?

I am using Kubuntu.

I can not install any package using pip.I uninstalled pip and reinstalled it restarted my computer, internet connection, terminal. But the problem remains the same.My internet connection has no issue.

It would be very helpful if you guys can give step by step solution.

samip@samip-Inspiron-3521:~$ pip3 install pygame

Collecting pygame
  WARNING: 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/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz
  WARNING: 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/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz
  WARNING: 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/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz
  WARNING: 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/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz
  WARNING: 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/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz

ERROR: Could not install packages due to an EnvironmentError: 
HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url:
 /packages/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-
1.9.6.tar.gz (Caused by ReadTimeoutError("HTTPSConnectionPool(host='files.pythonhosted.org', 
port=443): Read timed out. (read timeout=15)"))
1

2 Answers

As Nomi Shaw suggested, your problem seems to be a weak internet connection.

Also, please do not install third party packages into the global python interpreter by directly using pip or pip3.

Please, create and activate a virtual environment first.

RealPython.com has an excellent article about the why and the how:

3

Further to what Nomi Shaw and jugmac00 said, I had the same problem a couple of months back and it drove me crazy. I don't know how likely it is that you're experiencing the same problem but just in case:

My errors were caused by an internet filter I installed (Pluckeye) that it turns out was blocking not only my browser connections but all my other connections too (pip, calibre, r...). Once I set it to a lower level of restriction everything worked fine!

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sarah Jenkins
Author

Sarah Jenkins

Sarah Jenkins is a veteran tech journalist with over 12 years of experience covering artificial intelligence, mobile innovations, and digital ethics. Her insights have appeared in leading technology publications worldwide.