Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Problem to install pygame on ubuntu 20.04LTS

I am on Ubuntu 20.04LTS, and I try to install pygame (for python) for a school project. But when I try this:

sudo pip3 install pygame

I received an error:

ERROR: Command errored out with exit status 1:
 command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-szdn6q_u/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-szdn6q_u/pygame/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-3fqnujta
     cwd: /tmp/pip-install-szdn6q_u/pygame/
Complete output (18 lines):


WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
Using UNIX configuration...


Hunting dependencies...
SDL     : found 1.2.15
FONT    : not found
IMAGE   : not found
MIXER   : not found
PNG     : found
JPEG    : found
SCRAP   : found
PORTMIDI: not found
PORTTIME: not found
FREETYPE: found 23.1.17
Missing dependencies
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

Can you help me, please?

like image 990
Snakiron Avatar asked Jan 01 '23 00:01

Snakiron


1 Answers

Try installing it with

sudo apt install python3-pygame

instead. The error you are getting is because you are missing the Pygame dependencies, which apt should install for you.

As a general rule, it’s a good idea to install Python packages through the package manager, and use pip only if they’re unavailable there.

like image 163
LeopardShark Avatar answered Jan 02 '23 14:01

LeopardShark