0

I am trying to install Pygame and this message shows up:

WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pygame/
WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pygame/
WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pygame/
WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pygame/
WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pygame/
ERROR: Could not find a version that satisfies the requirement pygame (from versions: none)
ERROR: No matching distribution found for pygame

I am using python 3.9.2

hata
  • 10,652
  • 6
  • 37
  • 62
  • 3
    Okay, so did you *read* this message? Did you *try to make sense* out of it? In particular, where it says stuff like `ReadTimeoutError` and `connection broken`, and `Read timed out.`, does that suggest that maybe the problem has to do with your internet connection? – Karl Knechtel Mar 24 '21 at 12:46
  • it has nothing to do with the network its that pygame doesnt support python3.9 – TERMINATOR Mar 24 '21 at 12:52
  • Are you doing `pip install pygame` or `python3 -m pip install pygame` and do you also have python2 installed and what is your OS – TERMINATOR Mar 25 '21 at 06:37

3 Answers3

0

Your message says that:

after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")

You probably would install pygame with the Command Prompt (with pip)
But pip is a module that downloads modules from Pypi.org.

So, your computer probably failed to download the library.
This issue is caused by a poor Internet access.

How to remedy this:

1. Pip seems not to be working correctly with Python 3.9 so you should 1. upgrade pip or 2. downgrade Python to a working version.

2. I this doesn't solve your problem, try these ideas related to your connection

  • Check your Internet connection and retry
  • Maybe you use a proxy: override
  • The timed out error can be overridden by typing this in the Command Prompt: pip --default-timeout=1000 install [PACKAGENAME]
  • It also can be a firewall error, but again you can override it like that.
D_00
  • 1,312
  • 2
  • 11
  • 31
0

Solution

The most important part of the error message is:

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

You get this because pip can't find a stable version of pygame that is compatible with python3.9 from PyPi.The rest of the error message is a timout that happens because pip tries indefinitely to find a match but always comes up empty.

These are your options:

  1. Wait for support to be added for Python3.9

  2. Install the unsupported development verion like so:

    pip install pygame==2.0..0.dev22
    

    OR

    python -3.9 -m pip install pygame
    
  3. You can roll back your version to ptyhon3.8 or earlier.

TERMINATOR
  • 1,123
  • 1
  • 9
  • 23
0

You might need to give precedence to IPv4 over IPv6.

If you are running on windows, open CMD with administrator permissions and apply the following command:

netsh interface ipv6 set prefixpolicy ::ffff:0:0/96 46 4

If you are running on Ubuntu (You can easily convert the commands for any other linux distribution):

sudo sysctl -w net.ipv6.conf.all.disable_ipv6=1
sudo sysctl -w net.ipv6.conf.default.disable_ipv6=1
Eyal Golan
  • 1,761
  • 1
  • 13
  • 21