Install Pygame on Jetson nano?

I tried to install PyGame on jetson nano, even though I spent hours on it, it failed :
1.

sudo apt-get install python3-pygame

failed due to the package is not included in the os.
2.

pip install pygame --user

failed as well.

Thanks

What’s the error show when install.

Collecting pygame
Using cached https://files.pythonhosted.org/packages/0f/9c/78626be04e193c0624842090fe5555b3805c050dfaa81c8094d6441db2be/pygame-1.9.6.tar.gz
ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c β€˜import sys, setuptools, tokenize; sys.argv[0] = β€˜"’"’/tmp/pip-install-k4jvmk9f/pygame/setup.py’"’"’; file=’"’"’/tmp/pip-install-k4jvmk9f/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 pip-egg-info
cwd: /tmp/pip-install-k4jvmk9f/pygame/
Complete output (12 lines):

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

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

Hunting dependencies...
WARNING: "sdl-config" failed!
Unable to run "sdl-config". Please make sure a development version of SDL is installed.
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

You need to install libsdl1.2-dev for sdl-config error

sudo apt install libsdl1.2-dev

Thanks! new error now…

ERROR: Command errored out with exit status 1:
command: /usr/bin/python3 -c β€˜import sys, setuptools, tokenize; sys.argv[0] = β€˜"’"’/tmp/pip-install-54qtayvc/pygame/setup.py’"’"’; file=’"’"’/tmp/pip-install-54qtayvc/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 pip-egg-info
cwd: /tmp/pip-install-54qtayvc/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 21.0.15
Missing dependencies
----------------------------------------

ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

sudo apt-get install python-dev libsdl-image1.2-dev libsdl-mixer1.2-dev libsdl-ttf2.0-dev libsdl1.2-dev libsmpeg-dev python-numpy subversion libportmidi-dev ffmpeg libswscale-dev libavformat-dev libavcodec-dev

3 Likes

This helped a lot. But I needed one more lib:
sudo apt-get install libfreetype6-dev

2 Likes