Pi 4B 1GB, Bookworm Desktop 32-bit, Wayland and 'labwc'
If I make a remote connection to this Pi I can run Python 3 programs which use PyGame and they all execute. When I try to run them from a Terminal opened from the desktop they all report the PyGame module is not found. I am also seeing slightly different behaviour depending on what I remotely connect in to -
For "labwc" I guess I no longer need to specify the display to use, and for X11 and "wayfire" I simply haven't remembered the correct prefix yet. I will return to that once the bigger problem is fixed.
The problem when run under the desktop initially appeared to be the virtual environment not being activated on auto-login. I added some logging to '.profile' so I could see what was happening. That looks okay following "reboot", "desktop auto-login", open a terminal, look at the logs -The time stamp on the last would seem to indicate the first were booting or start-up events. The last opening the terminal.
So in all cases it appears the virtual environment were activated. But if I try to run a PyGame using program ...And running my tool which shows what the Python environment is, it seems it's not activated.If I now make a remote connection, there's an extra log entry added -My tool reports the virtual environment is active, and 'pygame' is in the search path ...And my PyGame using code executes ...And I am looking at the pretty colours as expected on my monitor.
I used to be able to run PyGame programs from a desktop Terminal shell, so why can't I now ? How do I figure out what's happening, fix that ?
If I make a remote connection to this Pi I can run Python 3 programs which use PyGame and they all execute. When I try to run them from a Terminal opened from the desktop they all report the PyGame module is not found. I am also seeing slightly different behaviour depending on what I remotely connect in to -
Code:
.-------------------.------------------. | Remote Connection | Desktop Terminal |.-----------------|-------------------|------------------|| X11 | Runs. No display | Missing PyGame || Wayland wayfire | Runs, No display | Missing PyGame || Wayland labwc | Runs, Displays | Missing PyGame |`-----------------^-------------------^------------------'
The problem when run under the desktop initially appeared to be the virtual environment not being activated on auto-login. I added some logging to '.profile' so I could see what was happening. That looks okay following "reboot", "desktop auto-login", open a terminal, look at the logs -
Code:
pi@Pi4B:~ $ cat log---Sat 11 May 16:40:51 BST 2024Desktop=LXDE-pi-labwcIs managedActivated---Sat 11 May 16:40:57 BST 2024Desktop=LXDE-pi-labwcIs managed---Sat 11 May 16:40:57 BST 2024Activated<--- This presumably belongs to the previousDesktop=LXDE-pi-labwcIs managedActivated---Sat 11 May 16:40:59 BST 2024Desktop=LXDE-pi-labwcIs managedActivated
So in all cases it appears the virtual environment were activated. But if I try to run a PyGame using program ...
Code:
pi@Pi4B:~ $ cd ~/apps/pygame/pi@Pi4B:~/apps/pygame $ ./pride-progress.pyTraceback (most recent call last): File "/home/pi/apps/pygame/./pride-progress.py", line 39, in <module> import pygameModuleNotFoundError: No module named 'pygame'
Code:
pi@Pi4B:~/apps/pygame $ mptool show envPython version : 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]Executable (topExe) : /usr/local/bin/mptoolExecutable (rawExe) : /home/pi/pico/micropython/ports/picopython/mptool/mptool.pySuper user privilege : FalseManaged packages : False - Found '/usr/lib/python3.11/EXTERNALLY-MANAGED'Virtual environment : False - Found '/home/pi/.env'sys.executable : /usr/bin/python3sys.prefix : /usrsys.base_prefix : /usrPackage search path : /home/pi/pico/micropython/ports/picopython/mptool Found /usr/lib/python311.zip Missing /usr/lib/python3.11 Found /usr/lib/python3.11/lib-dynload Found /home/pi/.local/lib/python3.11/site-packages Empty /usr/local/lib/python3.11/dist-packages Found /usr/lib/python3/dist-packages Found /usr/lib/python3.11/dist-packages FoundSystem packages : /usr/local/lib/python3.11/dist-packages adafruit_ampy-1.1.0 blinker-1.7.0 mpremote-1.21.0
Code:
Sat 11 May 17:00:53 BST 2024Desktop=LXDE-pi-labwcIs managedActivated
Code:
pi@Pi4B:~ $ mptool show envPython version : 3.11.2 (main, Mar 13 2023, 12:18:29) [GCC 12.2.0]Executable (topExe) : /usr/local/bin/mptoolExecutable (rawExe) : /home/pi/pico/micropython/ports/picopython/mptool/mptool.pySuper user privilege : FalseManaged packages : True - Found '/usr/lib/python3.11/EXTERNALLY-MANAGED'Virtual environment : True - Found '/home/pi/.env'sys.executable : /home/pi/.env/bin/python3sys.prefix : /home/pi/.envsys.base_prefix : /usrPackage search path : /home/pi/pico/micropython/ports/picopython/mptool Found /usr/lib/python311.zip Missing /usr/lib/python3.11 Found /usr/lib/python3.11/lib-dynload Found /home/pi/.env/lib/python3.11/site-packages Found /home/pi/.local/lib/python3.11/site-packages Empty /usr/local/lib/python3.11/dist-packages Found /usr/lib/python3/dist-packages Found /usr/lib/python3.11/dist-packages FoundLocal user packages : /home/pi/.env/lib/python3.11/site-packages blinker-1.7.0 bluepy-1.3.0 littlefs_python-0.9.1 netifaces-0.11.0 networkzero-1.0b1 paho_mqtt-1.6.1 pip-23.0.1 pygame-2.5.2 pyzmq-25.1.2 rpi_lgpio-0.4 setuptools-66.1.1 wiringpi-2.60.1 wiringpi2-2.32.3System packages : /usr/local/lib/python3.11/dist-packages adafruit_ampy-1.1.0 blinker-1.7.0 mpremote-1.21.0
Code:
pi@Pi4B:~/apps/pygame $ ./pride-progress.py<frozen importlib._bootstrap>:241: RuntimeWarning: Your system is neon capable but pygame was not built with support for it. The performance of some of your blits could be adversely affected. Consider enabling compile time detection with environment variables like PYGAME_DETECT_AVX2=1 if you are compiling without cross compilation.pygame 2.5.2 (SDL 2.26.5, Python 3.11.2)Hello from the pygame community. https://www.pygame.org/contribute.html
I used to be able to run PyGame programs from a desktop Terminal shell, so why can't I now ? How do I figure out what's happening, fix that ?
Statistics: Posted by hippy — Sat May 11, 2024 4:19 pm