Tiny Core Linux

Tiny Core Base => Raspberry Pi => Topic started by: Ripley on March 27, 2022, 06:36:12 PM

Title: raspberry pi unable to install pygame
Post by: Ripley 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!
Title: Re: raspberry pi unable to install pygame
Post by: polikuo 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
Title: Re: raspberry pi unable to install pygame
Post by: Ripley on March 27, 2022, 10:08:51 PM
Thanks for the welcome

I just installed compiletc, same issue
Title: Re: raspberry pi unable to install pygame
Post by: polikuo 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
Title: Re: raspberry pi unable to install pygame
Post by: polikuo 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
Title: Re: raspberry pi unable to install pygame
Post by: Ripley 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
Title: Re: raspberry pi unable to install pygame
Post by: polikuo 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/ (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
Title: Re: raspberry pi unable to install pygame
Post by: Juanito on March 29, 2022, 01:02:43 AM
Ref: "SDL     : found 2.0.16" - does sdl2 need updating for pygame to work?
Title: Re: raspberry pi unable to install pygame
Post by: Juanito 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
Title: Re: raspberry pi unable to install pygame
Post by: polikuo 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
Title: Re: raspberry pi unable to install pygame
Post by: Juanito on March 29, 2022, 04:40:59 AM
I had a look at this in x86_64 - the following might be useful to compile pygame on piCore:

http://tinycorelinux.net/13.x/x86_64/tcz/src/portmidi/
http://tinycorelinux.net/8.x/x86_64/tcz/src/sdl2_image/
http://tinycorelinux.net/10.x/x86_64/tcz/src/sdl2_mixer/
http://tinycorelinux.net/10.x/x86_64/tcz/src/sdl2_ttf/
http://tinycorelinux.net/13.x/x86_64/tcz/src/pygame/
Title: Re: raspberry pi unable to install pygame
Post by: Ripley 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?)
Title: Re: raspberry pi unable to install pygame
Post by: Juanito 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.
Title: Re: raspberry pi unable to install pygame
Post by: Ripley 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
Title: Re: raspberry pi unable to install pygame
Post by: Juanito 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 ../
Title: Re: raspberry pi unable to install pygame
Post by: Ripley on June 21, 2022, 04:10:29 PM
Sorry for the delay in a response, life got busy.

I just attempted another run on making the SDL2_Mixer extension, I tried installing the opusfile-dev but found that there is no files avaiable under that name in "Apps downloader" , so i tried installing libopus-dev and libopus instead (assuming that they might suffice as an alternative), then I applied the complier flags (which I finally managed to get right) and a WARNING came up 'unable to find opusfile library...' I came this far so I attempted the code "find . -name Makefile -type f -exec sed -i 's/-g -O2//g' {} \;" but nothing seemed to happen, perhaps my processor is slow and I had to wait longer? I then tried to 'make'. Which raised an error of 'no Make file', or something along that line. I presume the Opusfile is required.

Is there a way to get this working without getting Opusfile from source?
Title: Re: raspberry pi unable to install pygame
Post by: Ripley on June 21, 2022, 05:51:40 PM
Just attempted to create SDL2_tff-2.0.15 extension (which is different extension from above) but ran into this error during configure
Code: (bash) [Select]
Checking wheather build enviroment is sane... configure: error: newly created file is older than distributed files! Check your system clock
any suggestions on how to proceed or fix error?

Title: Re: raspberry pi unable to install pygame
Post by: tacpilot on June 21, 2022, 06:19:11 PM
maybe your bios battery is dead ??
setting up the system to use NTP is good to keep all systems
inline and eliminate issues with clock drift.

NOTE: failing motherboards can have issue keeping time. I have 2 machines at work
that fail to keep date time even with new batteries .. is a  PITA because they require
system cycle every 24 hours and the evironment they are in requires a 2 hour boot time  :o
Title: Re: raspberry pi unable to install pygame
Post by: Ripley on June 21, 2022, 08:22:29 PM
Im pretty sure the Raspberry Pi zero doesn't have a bios battery, I could be wrong though.

but your comment tacpilot, reminded me of something, an option in the "control panel" app, 'date and time'.
I was able to change the date from 1970 to the current date. This fixed the error I was getting.

I now have an error after/during running 'make'.

Code: (bash) [Select]
/usr/local/bin/grep: /usr/local/lib/libglib-2.0.21: No such file or directory
/usr/local/bin/sed: can't read /usr/local/lib/libglib-2.0.1a: No such file or dierectory
libtool: link: '/usr/local/lib/libglib-2.0.1a' is not a valid libtool archive
make: ***[Makefile:517: libSDL2_tff.1a] Error 1

I see that 'libglib' is missing, I'm just curious if I need to download it from source or if there is a more easy fix?
Title: Re: raspberry pi unable to install pygame
Post by: Rich on June 22, 2022, 12:37:54 AM
Hi Ripley
Im pretty sure the Raspberry Pi zero doesn't have a bios battery, I could be wrong though. ...
You are correct. Pi does not have a BIOS.

/usr/local/lib/libglib-2.0.la  was last available in  glib2-dev.tcz  from  TC10:
http://tinycorelinux.net/10.x/armv7/tcz/glib2-dev.tcz.list
Title: Re: raspberry pi unable to install pygame
Post by: tacpilot on June 22, 2022, 12:52:39 AM
My bad .. I made the assumption you were compiling code
on your desktop for use on pi..   :-X
Title: Re: raspberry pi unable to install pygame
Post by: Ripley on June 22, 2022, 01:06:25 AM
Hey Rich,
/usr/local/lib/libglib-2.0.la  was last available in  glib2-dev.tcz  from  TC10:
http://tinycorelinux.net/10.x/armv7/tcz/glib2-dev.tcz.list
is there a way to aquire the glib extenstion/documentation directly from an older version of TC without the need to compile/make?
Title: Re: raspberry pi unable to install pygame
Post by: Juanito on June 22, 2022, 04:22:47 AM
Somewhat counterintuitively, if you delete all of the *.la files in /usr/lib and /usr/local/lib and then re-run the ./configure script, things will work.
Title: Re: raspberry pi unable to install pygame
Post by: Juanito on June 22, 2022, 04:49:51 AM
Is there a way to get this working without getting Opusfile from source?

opusfile extensions posted