WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: raspberry pi unable to install pygame  (Read 6408 times)

Offline Ripley

  • Newbie
  • *
  • Posts: 17
raspberry pi unable to install pygame
« on: March 27, 2022, 06:36:12 PM »
Im using a raspberry pi 3 B+ as my builder (a way for me to download all the files needed) for my raspberry pi zero (with no internet connection, hense the need for the builder) and I am trying to install python3's module pygame. But everytime I Pip install pygame, the download finishes and I am left with an error saying "python setup.py egg_info did not run successfully". I have updated my pip and setuptools for python. I have tried pip install on other modules such as mutagen and had success,

If someone could help me out, that would be great!

Offline polikuo

  • Hero Member
  • *****
  • Posts: 736
Re: raspberry pi unable to install pygame
« Reply #1 on: March 27, 2022, 09:21:53 PM »
Hi, Ripley
Welcome to the forum
Have you installed compiletc ?
Some python modules use compiler during installation

Offline Ripley

  • Newbie
  • *
  • Posts: 17
Re: raspberry pi unable to install pygame
« Reply #2 on: March 27, 2022, 10:08:51 PM »
Thanks for the welcome

I just installed compiletc, same issue
« Last Edit: March 27, 2022, 10:11:28 PM by Ripley »

Offline polikuo

  • Hero Member
  • *****
  • Posts: 736
Re: raspberry pi unable to install pygame
« Reply #3 on: March 28, 2022, 08:50:48 AM »
This is what I do on raspberry pi 4 with aarch64

Code: [Select]
tc@pi4:~$ tce-load -i python3.8-pip python3.8-setuptools compiletc
tc@pi4:~$ pip install pygame
Collecting pygame
  Downloading pygame-2.1.2-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (20.7 MB)
     |████████████████████████████████| 20.7 MB 444 kB/s
Installing collected packages: pygame
Successfully installed pygame-2.1.2
WARNING: You are using pip version 20.1.1; however, version 22.0.4 is available.
You should consider upgrading via the '/usr/local/bin/python3 -m pip install --upgrade pip' command.
tc@pi4:~$ echo $?
0

Offline polikuo

  • Hero Member
  • *****
  • Posts: 736
Re: raspberry pi unable to install pygame
« Reply #4 on: March 28, 2022, 11:47:18 AM »
Hmm.
On aarch64, pip doesn't ask for any dependencies at all
On armv7l, however, it's asking for several headers and can't be bypassed even if you specify --install-option='-auto'
I think they have binaries pre-compiled for certain architecture.
Code: [Select]
tc@pi3:~$ tce-load -i SDL2_image-dev compiletc freetype-dev python3.8-pip python3.8-setuptools libX11-dev
tc@pi3:~$ pip3 install pygame --user
Collecting pygame
  Downloading pygame-2.1.2.tar.gz (10.1 MB)
     |████████████████████████████████| 10.1 MB 5.5 MB/s
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python3.8 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-o5tozjcu/pygame/setup.py'"'"'; __file__='"'"'/tmp/pip-install-o5tozjcu/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-grvt033y
         cwd: /tmp/pip-install-o5tozjcu/pygame/
    Complete output (31 lines):


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

    WARNING:root:Some pygame dependencies were not found. Pygame can still compile and install, but games that depend on those missing dependencies will not run. Use -auto to continue building without all dependencies.
    Missing dependencies

    Hunting dependencies...
    SDL     : found 2.0.16
    FONT    : not found
    FONT SDL_ttf.h libSDL2_ttf.so ['/usr/include', '/usr/include/SDL2', '/usr/local/include', '/usr/local/include/SDL2', '/usr/X11R6/include', '/usr/local/include/SDL2'] ['/usr/lib', '/usr/lib64', '/usr/X11R6/lib', '/usr/lib/i386-linux-gnu', '/usr/lib/x86_64-linux-gnu', '/usr/lib/arm-linux-gnueabihf/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib', '/usr/local/lib64', '/usr/local/X11R6/lib', '/usr/local/lib/i386-linux-gnu', '/usr/local/lib/x86_64-linux-gnu', '/usr/local/lib/arm-linux-gnueabihf/', '/usr/local/lib/aarch64-linux-gnu/', '/usr/local/lib']
    IMAGE   : found
    MIXER   : not found
    MIXER SDL_mixer.h libSDL2_mixer.so ['/usr/include', '/usr/include/SDL2', '/usr/local/include', '/usr/local/include/SDL2', '/usr/X11R6/include', '/usr/local/include/SDL2'] ['/usr/lib', '/usr/lib64', '/usr/X11R6/lib', '/usr/lib/i386-linux-gnu', '/usr/lib/x86_64-linux-gnu', '/usr/lib/arm-linux-gnueabihf/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib', '/usr/local/lib64', '/usr/local/X11R6/lib', '/usr/local/lib/i386-linux-gnu', '/usr/local/lib/x86_64-linux-gnu', '/usr/local/lib/arm-linux-gnueabihf/', '/usr/local/lib/aarch64-linux-gnu/', '/usr/local/lib']
    PNG     : found
    JPEG    : found
    SCRAP   : found
    PORTMIDI: not found
    PORTMIDI portmidi.h libportmidi.so ['/usr/include', '/usr/include/SDL2', '/usr/local/include', '/usr/local/include/SDL2', '/usr/X11R6/include', '/usr/local/include/SDL2'] ['/usr/lib', '/usr/lib64', '/usr/X11R6/lib', '/usr/lib/i386-linux-gnu', '/usr/lib/x86_64-linux-gnu', '/usr/lib/arm-linux-gnueabihf/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib', '/usr/local/lib64', '/usr/local/X11R6/lib', '/usr/local/lib/i386-linux-gnu', '/usr/local/lib/x86_64-linux-gnu', '/usr/local/lib/arm-linux-gnueabihf/', '/usr/local/lib/aarch64-linux-gnu/', '/usr/local/lib']
    PORTTIME: not found
    PORTTIME porttime.h libporttime.so ['/usr/include', '/usr/include/SDL2', '/usr/local/include', '/usr/local/include/SDL2', '/usr/X11R6/include', '/usr/local/include/SDL2'] ['/usr/lib', '/usr/lib64', '/usr/X11R6/lib', '/usr/lib/i386-linux-gnu', '/usr/lib/x86_64-linux-gnu', '/usr/lib/arm-linux-gnueabihf/', '/usr/lib/aarch64-linux-gnu/', '/usr/local/lib', '/usr/local/lib64', '/usr/local/X11R6/lib', '/usr/local/lib/i386-linux-gnu', '/usr/local/lib/x86_64-linux-gnu', '/usr/local/lib/arm-linux-gnueabihf/', '/usr/local/lib/aarch64-linux-gnu/', '/usr/local/lib']
    FREETYPE: found 23.1.17

    ---
    For help with compilation see:
        https://www.pygame.org/wiki/Compilation
    To contribute to pygame development see:
        https://www.pygame.org/contribute.html
    ---

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

You'll need these libraries and headders, which are not provided by TC repo.
You have to build them from source if you really want pygame.
Code: [Select]
SDL_ttf.h libSDL2_ttf.so
SDL_mixer.h libSDL2_mixer.so
portmidi.h libportmidi.so
porttime.h libporttime.so
« Last Edit: March 28, 2022, 11:56:03 AM by polikuo »

Offline Ripley

  • Newbie
  • *
  • Posts: 17
Re: raspberry pi unable to install pygame
« Reply #5 on: March 28, 2022, 01:28:43 PM »
Okay, Pygame is pretty essential, so I think I'll attempt building them from source.

I'm not too familiar with this process, and even what location to put these files into... could you either walk me through it or direct me to a link in which I could follow some steps?

thank you so much

Offline polikuo

  • Hero Member
  • *****
  • Posts: 736
Re: raspberry pi unable to install pygame
« Reply #6 on: March 29, 2022, 12:43:35 AM »
The wiki is dead again  :P

For SDL, you can PM juanito to ask him if he could update that to 2.0.20 or if it's OK for you to take over
You can follow the instructions here
http://tinycorelinux.net/13.x/armv7/tcz/src/sdl2/

I guess SDL_ttf and SDL_mixer should be similar

In general, when building extensions, I would do
  • getting the source code
  • configure with correct compiler flags, set prefix to /usr/local
  • make
  • make DESTDIR=/tmp/packing-stuff install
  • strip debug info from ELF binaries
  • split into several packages if needed
  • create a startup script if needed
  • set the ownership to root.root (startup script to root.staff)
  • pack up the extension with squashfs.tcz
  • use submitqc.tcz to check if I've missed something
  • mail the e-mail

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14823
Re: raspberry pi unable to install pygame
« Reply #7 on: March 29, 2022, 01:02:43 AM »
Ref: "SDL     : found 2.0.16" - does sdl2 need updating for pygame to work?

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14823
Re: raspberry pi unable to install pygame
« Reply #8 on: March 29, 2022, 01:06:16 AM »
could you either walk me through it or direct me to a link in which I could follow some steps?

Most python apps follow this general format:

http://www.tinycorelinux.net/12.x/armv7/tcz/src/python3.6-cryptography/compile_cryptography
..then you package the extension from /tmp/pkg

Offline polikuo

  • Hero Member
  • *****
  • Posts: 736
Re: raspberry pi unable to install pygame
« Reply #9 on: March 29, 2022, 01:57:47 AM »
Ref: "SDL     : found 2.0.16" - does sdl2 need updating for pygame to work?

Hi juanito

I believe the current one is fine, but pygame need SDL_ttf and SDL_mixer.
It's unclear whether these modules would work with older SDL or not.
Plus, there are two more dependencies required.
I've tried to bypass those, but couldn't.
Quote
portmidi.h libportmidi.so
porttime.h libporttime.so


Offline Ripley

  • Newbie
  • *
  • Posts: 17
Re: raspberry pi unable to install pygame
« Reply #11 on: April 06, 2022, 06:14:53 PM »
I realized that SDL2 was not installed on my device. I installed that through the TC app installer and then ran 'pip install pygame'.

This time I was presented with the missing dependancies, the same polikuo meantioned

Code: [Select]
SDL_ttf.h libSDL2_ttf.so
SDL_mixer.h libSDL2_mixer.so
portmidi.h libportmidi.so
porttime.h libporttime.so

I then attempted to compile from source, using the links provided by Juanito. I am not proficient in this step and continue to run into blocks. For example, the portmidi install requires cmake and Java SDK to make the Make files, so I installed raspian and portmidi's required apps and attempted to create the Make files. - to no success.

I feel like I might be able to properly install the other dependancies... Though it seems they must be installed in a proper order as some folders or 'dependacies' are missing? I am honestly really confused about this whole subject, I have been following this fourm http://forum.tinycorelinux.net/index.php/topic,18682.msg114360.html#msg114360 to compile and create tcz extentions... but as I said, to no success.  I have attempted this process almost 15 times now?

If anyone could somehow make/compile the files for me or something to help me in this process, that would be great!

A reminder I am using a RPI Zero and a RPI 3 B+ (the files must be able to run on the Zero, which is a ARM6 I believe?)
« Last Edit: April 06, 2022, 06:47:29 PM by Ripley »

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14823
Re: raspberry pi unable to install pygame
« Reply #12 on: April 07, 2022, 01:09:08 AM »
I then attempted to compile from source, using the links provided by Juanito. I am not proficient in this step and continue to run into blocks. For example, the portmidi install requires cmake and Java SDK to make the Make files, so I installed raspian and portmidi's required apps and attempted to create the Make files. - to no success.
Why would you install the raspian cmake when a cmake extension is available in the piCore repo? The java sdk is not required to build portmidi.

Quote
but as I said, to no success.  I have attempted this process almost 15 times now?
Rather than stating "to no success", you could state what actually happened so that forum users can help you.

Offline Ripley

  • Newbie
  • *
  • Posts: 17
Re: raspberry pi unable to install pygame
« Reply #13 on: April 07, 2022, 01:12:11 PM »
Why would you install the raspian cmake when a cmake extension is available in the piCore repo? The java sdk is not required to build portmidi.
I am aware that there is a cmake for TC but portmidi LINUX_README meantioned that Java SDK was required to create the make files and as far as I was aware TC doesn't have java for my TC version, thus I attempted it on Raspian, but you say java is not required, so I'll take your word for it and try it out. Thanks

Rather than stating "to no success", you could state what actually happened so that forum users can help you.
I do appologies for the vague 'to no success', you see the issue is that I'm not quite sure where I am going wrong and thus can't state anything. I'm going to take another stab at it and document my progression so I can give a more detailed "where I went wrong".

Though as of this moment I am not quite sure how to apply the correct compiler flags and that might be my problem

Online Juanito

  • Administrator
  • Hero Member
  • *****
  • Posts: 14823
Re: raspberry pi unable to install pygame
« Reply #14 on: April 09, 2022, 06:20:38 AM »
Taking this as an example: http://tinycorelinux.net/13.x/x86_64/tcz/src/portmidi/compile_portmidi

..the compiler flags for piCore would be passed like this:
Code: [Select]
cmake -LAH -DCMAKE_C_FLAGS_RELEASE="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe" -DCMAKE_CXX_FLAGS_RELEASE="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -Os -pipe -fno-exceptions -fno-rtti  -DNDEBUG" -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_BUILD_TYPE=Release -DCMAKE_VERBOSE_MAKEFILE=TRUE -DCMAKE_INSTALL_LIBDIR=lib ../