Error occurred when installing package pygame

Environment: You can get some of this info from the text that pops up in the console when you run a pygame program. Operating system (e.g. Windows, Linux(Debian), Linux(Ubuntu), Mac): Windows Pytho...

@Matiiss

This is not exactly a bug, it’s that there are no release wheels yet for 3.11, use pip install pygame --pre (--pre stands for pre release), it will install pygame 2.1.3.dev8 and you can use that, 2.1.3 is coming soon but I can’t tell for sure when.

mariolacko, MaxWolf-01, wang551, rammfire, Zageron, aza547, johnp808, jeck3763, mikiweys, hit-the-dust, and 27 more reacted with thumbs up emoji
AntonioGms2007, ghanteyyy, freebird-2, Heebeaux, Be3y4uu-K0T, mikiweys, hit-the-dust, RodionYalyna, theRealProHacker, NikBandi, and 3 more reacted with laugh emoji
unowiz reacted with hooray emoji
marurunk, Px228, puisigblk, LeStefan04, bikrampun, Assentencia, Kocmocy-Da, and des5771 reacted with heart emoji

@ghost

Was able to duplicate this issue with:

  • Python 3.11.0
  • macOS Monterey 12.6
  • Pygame 2.1.2
    I used pip3 install pygame and got a huge error message, as shown in the OP.

I do have a question, if there is no wheel made for Python3 3.11.0, is installing pygame 2.1.3.dev8 the only option? Is this release stable?

@Matiiss

@arknaut Well, that’s the latest version of pygame that has wheels for Python 3.11 so it would be the most stable for that version of Python. Also, yeah, it should be stable enough on its own anyways, but again, it’s kind of temporary, I can’t tell for sure (or at all) but soon wheels for 2.1.3 should be released and they will be made for 3.11 too.

@ghost

@Matiiss — Okay thanks! (just clarifying) pygame 2.1.3.dev8 has been released as a temporary version of pygame so that python 3.11.0 users can continue using pygame.

@Matiiss

Uh, no, it’s more like 2.1.3.dev8 (it’s technically a pre-release btw) happens to have wheels for Python 3.11, it’s not specifically temporarily released for 3.11 because really 2.1.3 is kind of released already, it just doesn’t have wheels yet. But don’t take my word for it, however, I’m pretty sure it’s not something specifically done.

@ghost

@oddbookworm

2.1.3dev8 is the only version with 3.11 wheels prebuilt. If you really want to use 2.1.2, you’ll have to build the wheels yourself. But 2.1.3dev8 is essentially the full 2.1.3 release, but in pre-release form. It wasn’t specifically released to target 3.11, but since 3.11 was coming out soon, compatibility with 3.11 was added to dev8 by starbuck5 and ankith

@fladd

Are there any updates on this? Or an ETA for the new Pygame version?

@MyreMylar

@rammfire

Hello everyone. I observe the same problem on Armbian

pip install pygame
Defaulting to user installation because normal site-packages is not writeable
Collecting pygame
  Downloading pygame-2.1.2.tar.gz (10.1 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.1/10.1 MB 3.5 MB/s eta 0:00:00
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [30 lines of output]
      
      
      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using UNIX configuration...
      
      /bin/sh: 1: sdl2-config: not found
      /bin/sh: 1: sdl2-config: not found
      /bin/sh: 1: sdl2-config: not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/tmp/pip-install-m1yp62ur/pygame_44d4c02831ed4c49940d26d640b55b6a/setup.py", line 359, in <module>
          buildconfig.config.main(AUTO_CONFIG)
        File "/tmp/pip-install-m1yp62ur/pygame_44d4c02831ed4c49940d26d640b55b6a/buildconfig/config.py", line 225, in main
          deps = CFG.main(**kwds)
        File "/tmp/pip-install-m1yp62ur/pygame_44d4c02831ed4c49940d26d640b55b6a/buildconfig/config_unix.py", line 188, in main
          DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl']),
        File "/tmp/pip-install-m1yp62ur/pygame_44d4c02831ed4c49940d26d640b55b6a/buildconfig/config_unix.py", line 39, in __init__
          self.ver = config[0].strip()
      IndexError: list index out of range
      
      Hunting dependencies...
      
      ---
      For help with compilation see:
          https://www.pygame.org/wiki/Compilation
      To contribute to pygame development see:
          https://www.pygame.org/contribute.html
      ---
      
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

@oddbookworm

@rammfire if you read a few messages above, Matiiss gave the solution

@fladd

@rammfire if you read a few messages above, Matiiss gave the solution

Unfortunately this is not really a solution for other packages that depend on Pygame.

For instance, I am about to release a new version of Expyriment, which depends on Pygame, and I am currently mainly holding it back due to this issue. Would be great to have some idea on when proper Python 3.11 support is planned (roughly, like within the next few days, or will it still be months?).

@oddbookworm

@fladd The full release of 2.1.3 is almost out. I’m hoping it’ll be within a week or two at most, but that’s really up to the discretion of the lead maintainer right now

@freedom-penguin

Cant wait for the full release ! 😄

PeterJCLaw

added a commit
to PeterJCLaw/python-osc
that referenced
this issue

Nov 17, 2022

@PeterJCLaw

This was referenced

Nov 17, 2022

@liudonghua123

Though pip install pygame --pre works on python 3.11 on my windows 11. I would like to use the release version of pygame. 😄

Looking forward to pygame-2.1.3.

C:UsersLiu.D.H>pip install pygame --pre
Collecting pygame
  Downloading pygame-2.1.3.dev8-cp311-cp311-win_amd64.whl (10.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.6/10.6 MB 4.8 MB/s eta 0:00:00
Installing collected packages: pygame
Successfully installed pygame-2.1.3.dev8

C:UsersLiu.D.H>

@NikBandi

@AokiAhishatsu

C:UsersLiu.D.H>pip install pygame —pre

Can confirm this works. (Tested on Win10)

@Ivoz

I would advocate for a point release that basically doesn’t change anything from the previous, but simply provides wheels for the new python version. A lot of beginners will get caught up on this while a new patch release is prepared. e.g., 2.1.3 simply ships additional 3.11 wheels, 2.1.4 gets moved to new patch release.

@oddbookworm

I would advocate for a point release that basically doesn’t change anything from the previous, but simply provides wheels for the new python version. A lot of beginners will get caught up on this while a new patch release is prepared. e.g., 2.1.3 simply ships additional 3.11 wheels, 2.1.4 gets moved to new patch release.

To the best of my knowledge, 2.1.3 is ready for release. Just waiting on the head maintainer to actually release it.

@fladd

@fladd The full release of 2.1.3 is almost out. I’m hoping it’ll be within a week or two at most, but that’s really up to the discretion of the lead maintainer right now

Since it has been over a month now: Is there any news regarding the release?

@oddbookworm

Since it has been over a month now: Is there any news regarding the release?

To the best of my knowledge, the lead maintainer has not said anything to anyone in that time. Nobody else has the ability to release 2.1.3, so unfortunately we’re stuck waiting

@oddbookworm

@illume Python 3.11 has been out for a month and a half (and pygame’s main branch has been on 2.1.4dev1 for just as long). More and more people are starting to move to 3.11 and the fact that the only version of pygame with support for 3.11 requires knowledge of how to install a prerelease might detract users from continuing to use pygame. Is there something specific holding back the release? There are also other projects that are waiting for pygame 2.1.3 to fully release so they can update their dependencies.

@ea7kir

I’ve tried and tried, but can’t even instal the pre-release.
RPi 4B, Bullseye (64-bit), Python3.11.

pi@rxtouchlite:~/pgtest $ pip install pygame —pre
Collecting pygame
Downloading pygame-2.1.3.dev8.tar.gz (12.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.1/12.1 MB 2.8 MB/s eta 0:00:00
Preparing metadata (setup.py) … error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [33 lines of output]

  WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
  Using UNIX configuration...
  
  /bin/sh: 1: sdl2-config: not found
  /bin/sh: 1: sdl2-config: not found
  /bin/sh: 1: sdl2-config: not found
  Traceback (most recent call last):
    File "<string>", line 2, in <module>
    File "<pip-setuptools-caller>", line 34, in <module>
    File "/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/setup.py", line 399, in <module>
      buildconfig.config.main(AUTO_CONFIG)
    File "/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config.py", line 231, in main
      deps = CFG.main(**kwds, auto_config=auto)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config_unix.py", line 189, in main
      DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl']),
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config_unix.py", line 39, in __init__
      self.ver = config[0].strip()
                 ~~~~~~^^^
  IndexError: list index out of range
  
  Hunting dependencies...
  
  ---
  For help with compilation see:
      https://www.pygame.org/wiki/Compilation
  To contribute to pygame development see:
      https://www.pygame.org/contribute.html
  ---
  
  [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

@MyreMylar

Are you sure you are using the pip from python 3.11 there? Pis come with
multiple python versions. I thought you had to use pip3 on there

On Sat, 17 Dec 2022, 11:38 Michael Naylor, ***@***.***> wrote:
I’ve tried and tried, but can’t even instal the pre-release.
RPi 4B, Bullseye (64-bit), Python3.11.

***@***.***:~/pgtest $ pip install pygame —pre
Collecting pygame
Downloading pygame-2.1.3.dev8.tar.gz (12.1 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.1/12.1 MB 2.8 MB/s eta 0:00:00
Preparing metadata (setup.py) … error
error: subprocess-exited-with-error

× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [33 lines of output]

WARNING, No «Setup» File Exists, Running «buildconfig/config.py»

Using UNIX configuration…

/bin/sh: 1: sdl2-config: not found

/bin/sh: 1: sdl2-config: not found

/bin/sh: 1: sdl2-config: not found

Traceback (most recent call last):

File «<string>», line 2, in <module>

File «<pip-setuptools-caller>», line 34, in <module>

File «/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/setup.py», line 399, in <module>

buildconfig.config.main(AUTO_CONFIG)

File «/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config.py», line 231, in main

deps = CFG.main(**kwds, auto_config=auto)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File «/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config_unix.py», line 189, in main

DependencyProg(‘SDL’, ‘SDL_CONFIG’, ‘sdl2-config’, ‘2.0’, [‘sdl’]),

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

File «/tmp/pip-install-9_sp3ju8/pygame_06121d1e121e4eafb99504b0ad01a83b/buildconfig/config_unix.py», line 39, in __init__

self.ver = config[0].strip()

~~~~~~^^^

IndexError: list index out of range

Hunting dependencies…

For help with compilation see:

https://www.pygame.org/wiki/Compilation

To contribute to pygame development see:

https://www.pygame.org/contribute.html

[end of output]

note: This error originates from a subprocess, and is likely not a problem
with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.


Reply to this email directly, view it on GitHub
<#3522 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ADGDGGRVNWTT24EY5AYKHATWNWQ4BANCNFSM6AAAAAARQJB5DY>
.
You are receiving this because you commented.Message ID:
***@***.***>

@ea7kir

Are you sure you are using the pip from python 3.11 there? Pis come with multiple python versions. I thought you had to use pip3 on there

I think so. Both ‘pip’ and ‘pip3’ report version 22.3.1 from the same ‘penv global 3.11.0’.

@MyreMylar

Ah, I suspect it is because the pi is looking on the piwheels repository instead of PyPI and it won’t find any 3.11 wheels on piwheels because piwheels only builds wheels for a maximum of python 3.9.

If your pip is configured to use piwheels, but you want to use PyPI instead, you can remove or comment out the extra-index-url configuration in /etc/pip.conf

Otherwise you will have to learn to build pygame from source if you want to use 3.11 on a raspberry PI.

Trinkle23897

added a commit
to Trinkle23897/envpool
that referenced
this issue

Dec 28, 2022

@Trinkle23897

@dlwaters

Had same error. Used temporary fix.

Please, please, please post this solution on the homepage of Pygame!

I’m an experienced coder but new to python and spent several hours thinking I had done something wrong.

@oddbookworm

Unfortunately, the only person with access to the pygame.org website is the same person that can fix this whole mess in the first place. But, they’ve been unresponsive so far.

@dlwaters

But, they’ve been unresponsive so far.

Bummer. First installs always seem to go sideways. :-(

@khalzal

Hello, everybody.

I followed what was written here, but when I entered the «import pygame» command, I got an error (Windows can not find import).

Who can help? Where is my mistake? Which direction in should I look for a solution to the problem?

2023-02-03 161516
2023-02-03 161438

@oddbookworm

Did you try to run import pygame directly in command prompt? You need to be in an actual Python shell to do that (which you can get to just by typing python

@khalzal

Did you try to run import pygame directly in command prompt? You need to be in an actual Python shell to do that (which you can get to just by typing python

Thank you! This little detail helped a lot.

@tayler6000

I’m also trying to install from source at the moment and I’m getting the following error:

urllib.error.HTTPError: HTTP Error 503: Egress is over the account limit.

The pre-release wheel does work for me though.

You might encounter a problem when installing a Python package in the project settings or in the Python Package tool window. Eventually, most of the issues are out of IDE control as PyCharm uses the pip package manager to perform the actual installation.

This article provides troubleshooting tips and covers some typical cases.

Install a package using the Terminal

The most viable troubleshooting action is to try installing the problematic package on the selected Python interpreter using the terminal. If you get an identical error message, then the problem is not in the IDE and you should review the rationales and typical cases, or search for a solution on the Internet.

Install a package on a virtual environment

  1. Press Ctrl+Alt+S to open the IDE settings and select .

  2. Expand the list of the available interpreters and click Show All.

    Show all available interpreters

  3. Locate the target interpreter and press edit interpreter.

    Discover the interpreter path for the selected venv

    Copy or memorize the path of the virtual environment and close the dialogs.

  4. Open the terminal and run the following commands:

    source <venv path>/bin/activate
    pip install <package name>

    Installing a Python package on a virtual environment

  5. Inspect and parse the results.

Install a package on a Conda environment

  1. Open the terminal and run the following commands:

    Conda < 4.6

    Conda >= 4.6

    activate <conda env name>
    conda install <package name>

    conda activate <conda env name>
    conda install <package name>

    Conda < 4.6

    Conda >= 4.6

    source activate <conda env name>
    conda install <package name>

    conda activate <conda env name>
    conda install <package name>

    See Conda documentation for more information on how to activate an environment.

    Installing a Python package on a virtual environment

    One of the possible failure cases occurs when the target package is not available in the repositories supported by the Conda package manager.

    Fail to install a package on a Conda environment

  2. Inspect and parse the results.

Install a package on a system interpreter

  1. To check the path of the currently selected system interpreter that you were trying to install a package on, press Ctrl+Alt+S and go to .

  2. Expand the list of the project interpreters and scroll it down, then select the item.

    Selected Python interpreter

  3. Locate the interpreter and press edit interpreter.

    Discover the interpreter path for the selected venv

    Copy or memorize the path of the environment and close the dialogs.

  4. Open the terminal and run the following commands:

    cd <interpreter path>
    -m pip install <package name>

    Installing a Python package on a system environment

    You might need the admin privileges to install packages on a system interpreter.

  5. Inspect and parse the results.

Parse the results

Result

Action

The package cannot be installed because the Python version doesn’t satisfy the package requirement.

Try to create another Python interpreter that is based on the Python version that meets the requirement.

The package cannot be installed because you don’t have permissions to install it.

Try to install the package using super-user privileges, for example, sudo pip install <package name>.

The package cannot be installed because the package is not available in the repository that is supported by the selected package manager. Example: you’re trying to install a package that is not available in the Conda package manager repositories.

Try to configure another type of Python interpreter for your project and install the package on it. See how to add and modify a Python interpreter in Configure a Python interpreter.

The package cannot be installed and it matches one of the typical package installation failure cases.

Check the cases and apply related workarounds.

The package is successfully installed.

File an issue in the PyCharm issue tracker and provide explicit details about the case including all console output, error messages, and screenshots indicating that you tried to install the package on the same interpreter in the terminal and in the project settings or in the Python Packages tool window.

Review typical cases

Last modified: 16 December 2022

0 / 0 / 0

Регистрация: 26.10.2019

Сообщений: 1

1

26.10.2019, 13:09. Показов 7486. Ответов 3


Не могу установить pygame pip-ом через консоль, что можно сделать?

C:UsersXXX>pip install pygame
Collecting pygame
Using cached https://files.pythonhosted.org… 9.6.tar.gz
ERROR: Command errored out with exit status 1:
command: ‘c:usersxxxappdatalocalprogramspythonpython 38-32python.exe’ -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘»‘»‘C:\Users\XXX\AppData\Local\Temp\pip-install-orzmrx95\pygame\setup.py'»‘»‘; __file__='»‘»‘C:\Users\XXX\AppData\Local\Temp \pip-install-orzmrx95\pygame\setup.py'»‘»‘;f=getattr(tokenize , ‘»‘»‘open'»‘»‘, open)(__file__);code=f.read().replace(‘»‘»‘rn'»‘ «‘, ‘»‘»‘n'»‘»‘);f.close();exec(compile(code, __file__, ‘»‘»‘exec'»‘»‘))’ egg_info —egg-base ‘C:UsersXXXAppDataLocalTemppip-install-orzmrx95pygamepip-egg-info’
cwd: C:UsersXXXAppDataLocalTemppip-install-orzmrx95pygame
Complete output (17 lines):

WARNING, No «Setup» File Exists, Running «buildconfig/config.py»
Using WINDOWS configuration…

Download prebuilts to «prebuilt_downloads» and copy to «./prebuilt-x86»? [Y/n]Traceback (most recent call last):
File «<string>», line 1, in <module>
File «C:UsersXXXAppDataLocalTemppip-install-orzmrx95pygamesetup.py», line 194, in <module>
buildconfig.config.main(AUTO_CONFIG)
File «C:UsersXXXAppDataLocalTemppip-install-orzmrx95pygamebuildconfigconfig.py», line 210, in main
deps = CFG.main(**kwds)
File «C:UsersXXXAppDataLocalTemppip-install-orzmrx95pygamebuildconfigconfig_win.py», line 576, in main
and download_win_prebuilt.ask(**download_kwargs):
File «C:UsersXXXAppDataLocalTemppip-install-orzmrx95pygamebuildconfigdownload_win_prebuilt. py», line 302, in ask
reply = raw_input(
EOFError: EOF when reading a line
—————————————-
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь



0



1283 / 668 / 365

Регистрация: 07.01.2019

Сообщений: 2,176

26.10.2019, 13:54

2

Цитата
Сообщение от gvhvh
Посмотреть сообщение

Не могу установить pygame pip-ом через консоль, что можно сделать?

Установите python 3.7



0



Автоматизируй это!

Эксперт Python

6481 / 4174 / 1140

Регистрация: 30.03.2015

Сообщений: 12,325

Записей в блоге: 29

26.10.2019, 15:53

3

Цитата
Сообщение от gvhvh
Посмотреть сообщение

c:usersxxx

и кстати если юзер Вася или другое имя с кириллицей или спецсимволами то советую туда питон не устанавливать



0



Vigi

623 / 464 / 178

Регистрация: 28.05.2012

Сообщений: 1,386

29.10.2019, 05:40

4

Как вариант: качаете pygame тут для вашей версии ОС
и ставите также через Pip для моей x64 так:

Python
1
pip install pygame-1.9.6-cp38-cp38-win_amd64.whl



0



IT_Exp

Эксперт

87844 / 49110 / 22898

Регистрация: 17.06.2006

Сообщений: 92,604

29.10.2019, 05:40

Помогаю со студенческими работами здесь

Не могу устанавливать библиотеки через pip
Не могу устанавливать библиотеки через pip. Даже сам pip переустановить не могу. Результат всегда…

Можно ли сделать ,что бы запрос можно было запустить через кнопку на Форме?
Если можно ,то как?

Добавлено через 13 минут
Сейчас,создал форму,поставил кнопку,на нее выбрал…

При импорте pygame пишет что нет модуля pygame.base
Устанавливаю для kivy.Всё есть (sython,gsstreamer,kivy,pyscripter,python) , а вот фраем. pygame не…

Консоль не видит Pip
Консоль не видит pip. В path все добавил, pip обновил, но консоль все равно ругается. Что делать?

Искать еще темы с ответами

Или воспользуйтесь поиском по форуму:

4

Понравилась статья? Поделить с друзьями:
  • Error occurred when installing package pandas
  • Error occurred when installing package numpy
  • Error occurred when installing package dlib pycharm
  • Error occurred turn the main power switch off and on f24c
  • Error occurred turn the main power switch off and on f000 kyocera