How to fix pip3 install pygame error in macOS? [duplicate] - python

This question already has answers here:
Python pygame not installing
(3 answers)
How do I install pip on Windows?
(40 answers)
Closed last month.
This is what happens everytime I run this code "pip3 install pygame"...
pip3 install pygame
Collecting pygame
Using cached pygame-2.1.2.tar.gz (10.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using Darwin configuration...
/bin/sh: sdl2-config: command not found
/bin/sh: sdl2-config: command not found
/bin/sh: sdl2-config: command not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/setup.py", line 359, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/buildconfig/config.py", line 225, in main
deps = CFG.main(**kwds)
^^^^^^^^^^^^^^^^
File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/buildconfig/config_darwin.py", line 132, in main
[DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/buildconfig/config_unix.py", line 39, in __init__
self.ver = config[0].strip()
~~~~~~^^^
IndexError: list index out of range
---
For help with compilation see:
https://www.pygame.org/wiki/MacCompile
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.
Just like PortAudio which helps in the installation of pyaudio I want to know which package will help the installation of pygame ??
pyaudio installation also throws same type of error before installation of PortAudio. I install PortAudio which the help of Homebrew by the help of code "brew install portaudio".
I want to know the name of package(like portaudio) which help in the installation of pygame.
Please help....
I tried pip3 install pygame and I was expecting pygame to installed successfully.

Related

Installation py-pde issues

I am trying to install the python package py-pde.
My current python version is 3.9.
I pip install using the command 'pip install py-pde' on the terminal.
However, when I try to install it on my IDE - PyCharm - I get this error:
Collecting py-pde
Using cached py_pde-0.27.1-py3-none-any.whl (269 kB)
Requirement already satisfied: matplotlib>=3.1.0 in /Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/site-packages (from py-pde) (3.6.2)
Collecting numba>=0.56.0
Using cached numba-0.56.4.tar.gz (2.4 MB)
Preparing metadata (setup.py): started
Preparing metadata (setup.py): finished with status 'error'
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [8 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/sl/b99vml7s45q3zx3wb1fqvq240000gp/T/pip-install-pu5ucxpg/numba_1e4a8190083b40fba0897686608f79d0/setup.py", line 51, in <module>
_guard_py_ver()
File "/private/var/folders/sl/b99vml7s45q3zx3wb1fqvq240000gp/T/pip-install-pu5ucxpg/numba_1e4a8190083b40fba0897686608f79d0/setup.py", line 48, in _guard_py_ver
raise RuntimeError(msg.format(cur_py, min_py, max_py))
RuntimeError: Cannot install on Python version 3.11.0; only versions >=3.7,<3.11 are supported.
[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.
Any ideas what's wrong here?
Specifically, it says can't install on Python 3.11, even though I checked my python version using pip --version to be 3.9.
Not sure what's wrong. Help appreciated.
Should be as simple as alt+ctrl+s to go to settings.
Then navigate to Project: "Your project" >> Python Interpreter. Then just browse to the interpreter you want to use instead of 3.11.
Edit: Here's a link to JetBrains (PyCharm parent company) documentation that covers changing your interpreter.

Unable to install mysqlclient using virtualenv (Fedora 37) [duplicate]

This question already has answers here:
pip install mysql-python fails with EnvironmentError: mysql_config not found
(24 answers)
mysql_config not found when installing mysqldb python interface
(36 answers)
Closed 10 days ago.
I am developing an app using Django 4 and have set up a virtual environment using venv. The problem is that I cannot get the MySQL client package installed using pip to allow my Django app to connect to an existing MariaDB hosted on the same server.
I am using Fedora 37, Python 3.11.1 .
Every time I try to install mysqlclient via pip within my virtual environment I the below error:
(venv) $ pip install mysqlclient Collecting mysqlclient Using cached
mysqlclient-2.1.1.tar.gz (88 kB) Preparing metadata (setup.py) ...
error error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [18 lines of output]
/bin/sh: line 1: mysql_config: command not found
/bin/sh: line 1: mariadb_config: command not found
/bin/sh: line 1: mysql_config: command not found
Traceback (most recent call last):
File "", line 2, in
File "", line 34, in
File "/tmp/pip-install-fuegkdx1/mysqlclient_d3182534a7ce4d10ae4bceac47107c54/setup.py",
line 15, in
metadata, options = get_config()
^^^^^^^^^^^^
File "/tmp/pip-install-fuegkdx1/mysqlclient_d3182534a7ce4d10ae4bceac47107c54/setup_posix.py",
line 70, in get_config
libs = mysql_config("libs")
^^^^^^^^^^^^^^^^^^^^
File "/tmp/pip-install-fuegkdx1/mysqlclient_d3182534a7ce4d10ae4bceac47107c54/setup_posix.py",
line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
mysql_config --version
mariadb_config --version
mysql_config --libs
[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.

Why does an error pop up when installing the "librosa" library in the PyCharm development environment: "subprocess-exited-with-error"?

Here is the error itself. To install, I use the command "pip install librosa", Python version 3.11.0
Collecting numba\>=0.45.1
Using cached numba-0.56.4.tar.gz (2.4 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─\> \[8 lines of output\]
Traceback (most recent call last):
File "\<string\>", line 2, in \<module\>
File "\<pip-setuptools-caller\>", line 34, in \<module\>
File "C:\\Users\\merge\\AppData\\Local\\Temp\\pip-install-qgu9dc69\\numba_22de5875b2534efba1d1a87fc556500b\\setup.py", line 51, in \<module\>
\_guard_py_ver()
File "C:\\Users\\merge\\AppData\\Local\\Temp\\pip-install-qgu9dc69\\numba_22de5875b2534efba1d1a87fc556500b\\setup.py", line 48, in \_guard_py_ver
raise RuntimeError(msg.format(cur_py, min_py, max_py))
RuntimeError: Cannot install on Python version 3.11.0; only versions \>=3.7,\<3.11 are supported.
\[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.
I tried to install not in Pycharm and changed the version of Python, I did not find anything on the Internet about this error, everywhere they suggest installing via "conda". Is there another way?

Terminal says metadata-generation-failed when I try to install pygame [duplicate]

This question already has answers here:
Python pygame not installing
(3 answers)
Unable to install Pygame using pip
(27 answers)
Closed 3 months ago.
Defaulting to user installation because normal site-packages is not writeable
Collecting pygame
Using cached pygame-2.1.2.tar.gz (10.1 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [31 lines of output]
WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using Darwin configuration...
/bin/sh: sdl2-config: command not found
/bin/sh: sdl2-config: command not found
/bin/sh: sdl2-config: command not found
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "/private/var/folders/g2/rhy_hbw143xbvqmk9rhy17ym0000gp/T/pip-install-9jn1og6f/pygame_00f721271263459eb77e9aae1ed2e43a/setup.py", line 359, in <module>
buildconfig.config.main(AUTO_CONFIG)
File "/private/var/folders/g2/rhy_hbw143xbvqmk9rhy17ym0000gp/T/pip-install-9jn1og6f/pygame_00f721271263459eb77e9aae1ed2e43a/buildconfig/config.py", line 225, in main
deps = CFG.main(**kwds)
^^^^^^^^^^^^^^^^
File "/private/var/folders/g2/rhy_hbw143xbvqmk9rhy17ym0000gp/T/pip-install-9jn1og6f/pygame_00f721271263459eb77e9aae1ed2e43a/buildconfig/config_darwin.py", line 132, in main
[DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/private/var/folders/g2/rhy_hbw143xbvqmk9rhy17ym0000gp/T/pip-install-9jn1og6f/pygame_00f721271263459eb77e9aae1ed2e43a/buildconfig/config_unix.py", line 39, in __init__
self.ver = config[0].strip()
~~~~~~^^^
IndexError: list index out of range
---
For help with compilation see:
https://www.pygame.org/wiki/MacCompile
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.
metadata-generation-failed occurs whenever I try to install pygame. I updated pip to the latest version and I'm using python 3.11 and I also tried python 3.10.15 both same results. Please answer in MacOS terminal form as I'm using a Mac, thanks!

Getting "error while generating package metadata" when installing TkFontAwesome

I'm trying to install TkFontAwesome using python -m pip install tkfontawesome, but always get the following error:
Collecting tkfontawesome
Using cached tkfontawesome-0.2.0-py3-none-any.whl (405 kB)
Collecting tksvg==0.7.4
Using cached tksvg-0.7.4.tar.gz (50 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [12 lines of output]
Installing dependency cmake... Traceback (most recent call last):
File "<string>", line 36, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\myuser\AppData\Local\Temp\pip-install-2krbeh5s\tksvg_7491a69795da43779e9e71e527849349\setup.py", line 62, in <module>
sp.call(["pacman", "--needed", "--noconfirm", "-S", "mingw-w64-x86_64-{}".format(dep)]) # , stdout=sp.PIPE)
File "C:\Users\myuser\AppData\Local\Programs\Thonny\lib\subprocess.py", line 339, in call
with Popen(*popenargs, **kwargs) as p:
File "C:\Users\myuser\AppData\Local\Programs\Thonny\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "C:\Users\myuser\AppData\Local\Programs\Thonny\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
[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.
Never had any problems installing packages using pip before. The file subprocess.py IS in \Thonny\lib\ if this WinError 2 means that.
I'm using:
Python 3.7.7
pip 22.0.3
Tk 8.6.9
Thonny 3.2.7
Windows 10
So far i've tried:
to update my pip and setuptools (they're already up-to-date)
to install TkFontAwesome using ez_setup
to install TkFontAwesome using --use-deprecated=backtrack-on-build-failures
No use. Anyone have any ideas what to do next? Thanks in advance.
Try add this after your pip3 install package:
--use-deprecated=backtrack-on-build-failures
eg, if you want:
pip3 install imageAI
then:
pip3 install imageAI --use-deprecated=backtrack-on-build-failures
copy from there.

Categories

Resources