-1

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
  • 11,633
  • 6
  • 46
  • 69
  • 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

1

From the error log you provided:

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

I guess you probably tried to install pygame with the pip module through the Command Prompt.
However, pip needs to connect to pypi.org in order to download the module's files.

So, your computer probably failed to download the library.
This issue can be caused either by a poor Internet connection, or by an issue on pip's side.

How to solve this issue:

  1. At the time of posting, pip seems not to be working correctly with Python 3.9 so you can:

[EDIT] As of 2023, this issue is now solved.

  1. If this doesn't help, try these fixes:
    • Check your Internet connection and retry
    • Maybe you are using a proxy: override
    • The timeout can be overridden by typing this in the Command Prompt: pip --default-timeout=1000 install [PACKAGENAME]
    • It could also be caused by a firewall, which you can override.

Hope that helps!

D_00
  • 1,440
  • 2
  • 13
  • 32
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,180
  • 1
  • 11
  • 24
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