electronstudio / raylib-python-cffi

Python CFFI bindings for Raylib
http://electronstudio.github.io/raylib-python-cffi
Eclipse Public License 2.0
142 stars 29 forks source link

problem running on Raspberry Pi 4 #123

Closed raspberrypisig closed 2 weeks ago

raspberrypisig commented 2 months ago

Noob here.

Running raspbian bullseye (64-bit version). Haven't tested 32-bit OS version.

running quickstart program.

Traceback (most recent call last):
  File "/home/pi/.pyenv/versions/3.12.1/bin/gui", line 5, in <module>
    from gui.main import main
  File "/home/pi/Developer/python/gui/gui/main.py", line 1, in <module>
    from pyray import *
  File "/home/pi/.pyenv/versions/3.12.1/lib/python3.12/site-packages/pyray/__init__.py", line 15, in <module>
    from raylib import rl, ffi
  File "/home/pi/.pyenv/versions/3.12.1/lib/python3.12/site-packages/raylib/__init__.py", line 15, in <module>
    from ._raylib_cffi import ffi, lib as rl
ModuleNotFoundError: No module named 'raylib._raylib_cffi'

Tried it in both in a venv and straight.

I noticed that on windows, there is a _raylib_cffi.pyd file inside the site-packages/raylib/ (I'm assuming this is like a dll), but I could not find an equivalent file(assuming there should be a _raylib_cffi.so)

Not sure what more info would be helpful.

raspberrypisig commented 2 months ago

FWIW.

2024-04-05 17:19:52.452 [info] CREATED_VENV:/home/pi/Developer/python/gui/.venv/bin/python
Creating: /home/pi/Developer/python/gui/.venv/.gitignore
2024-04-05 17:19:52.454 [info] CREATE_VENV.UPGRADING_PIP
Running: /home/pi/Developer/python/gui/.venv/bin/python -m pip install --upgrade pip
2024-04-05 17:19:54.384 [info] Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
2024-04-05 17:19:54.393 [info] Requirement already satisfied: pip in ./.venv/lib/python3.11/site-packages (22.3)
2024-04-05 17:19:56.591 [info] Collecting pip
2024-04-05 17:19:56.975 [info]   WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ProtocolError('Connection aborted.', RemoteDisconnected('Remote end closed connection without response'))': /simple/pip/pip-24.0-py3-none-any.whl
2024-04-05 17:19:58.217 [info]   Using cached https://www.piwheels.org/simple/pip/pip-24.0-py3-none-any.whl (2.1 MB)
2024-04-05 17:19:58.614 [info] Installing collected packages: pip
2024-04-05 17:19:58.615 [info]   Attempting uninstall: pip
2024-04-05 17:19:58.629 [info]     Found existing installation: pip 22.3
2024-04-05 17:19:59.756 [info]     Uninstalling pip-22.3:
2024-04-05 17:19:59.798 [info]       Successfully uninstalled pip-22.3
2024-04-05 17:20:06.763 [info] Successfully installed pip-24.0
2024-04-05 17:20:07.520 [info] CREATE_VENV.UPGRADED_PIP
VENV_INSTALLING_PYPROJECT: /home/pi/Developer/python/gui/pyproject.toml
Running: /home/pi/Developer/python/gui/.venv/bin/python -m pip install -e .
2024-04-05 17:20:09.747 [info] Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
2024-04-05 17:20:09.754 [info] Obtaining file:///home/pi/Developer/python/gui
2024-04-05 17:20:09.770 [info]   Installing build dependencies: started
2024-04-05 17:20:19.070 [info]   Installing build dependencies: finished with status 'done'
2024-04-05 17:20:19.074 [info]   Checking if build backend supports build_editable: started
2024-04-05 17:20:20.495 [info]   Checking if build backend supports build_editable: finished with status 'done'
2024-04-05 17:20:20.498 [info]   Getting requirements to build editable: started
2024-04-05 17:20:21.933 [info]   Getting requirements to build editable: finished with status 'done'
2024-04-05 17:20:21.946 [info]   Installing backend dependencies: started
2024-04-05 17:20:27.006 [info]   Installing backend dependencies: finished with status 'done'
2024-04-05 17:20:27.008 [info]   Preparing editable metadata (pyproject.toml): started
2024-04-05 17:20:28.423 [info]   Preparing editable metadata (pyproject.toml): finished with status 'done'
2024-04-05 17:20:30.559 [info] Collecting requests (from gui==0.0.1)
2024-04-05 17:20:30.892 [info]   Using cached https://www.piwheels.org/simple/requests/requests-2.31.0-py3-none-any.whl (62 kB)
2024-04-05 17:20:31.586 [info] Collecting raylib (from gui==0.0.1)
2024-04-05 17:20:31.600 [info]   Using cached raylib-5.0.0.1.tar.gz (79 kB)
2024-04-05 17:20:31.705 [info]   Installing build dependencies: started
2024-04-05 17:20:42.082 [info]   Installing build dependencies: finished with status 'done'
2024-04-05 17:20:42.088 [info]   Getting requirements to build wheel: started
2024-04-05 17:20:42.950 [info]   Getting requirements to build wheel: finished with status 'done'
2024-04-05 17:20:42.960 [info]   Installing backend dependencies: started
2024-04-05 17:20:48.962 [info]   Installing backend dependencies: finished with status 'done'
2024-04-05 17:20:48.967 [info]   Preparing metadata (pyproject.toml): started
2024-04-05 17:20:49.970 [info]   Preparing metadata (pyproject.toml): finished with status 'done'
2024-04-05 17:20:52.395 [info] Collecting cffi>=1.14.6 (from raylib->gui==0.0.1)
2024-04-05 17:20:52.549 [info]   Downloading cffi-1.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (1.5 kB)
2024-04-05 17:20:52.987 [info] Collecting inflection (from raylib->gui==0.0.1)
2024-04-05 17:20:53.319 [info]   Using cached https://www.piwheels.org/simple/inflection/inflection-0.5.1-py2.py3-none-any.whl (9.5 kB)
2024-04-05 17:20:54.163 [info] Collecting charset-normalizer<4,>=2 (from requests->gui==0.0.1)
2024-04-05 17:20:54.174 [info]   Using cached charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.metadata (33 kB)
2024-04-05 17:20:54.682 [info] Collecting idna<4,>=2.5 (from requests->gui==0.0.1)
2024-04-05 17:20:55.015 [info]   Using cached https://www.piwheels.org/simple/idna/idna-3.6-py3-none-any.whl (61 kB)
2024-04-05 17:20:55.790 [info] Collecting urllib3<3,>=1.21.1 (from requests->gui==0.0.1)
2024-04-05 17:20:56.116 [info]   Using cached https://www.piwheels.org/simple/urllib3/urllib3-2.2.1-py3-none-any.whl (121 kB)
2024-04-05 17:20:56.657 [info] Collecting certifi>=2017.4.17 (from requests->gui==0.0.1)
2024-04-05 17:20:56.992 [info]   Using cached https://www.piwheels.org/simple/certifi/certifi-2024.2.2-py3-none-any.whl (163 kB)
2024-04-05 17:20:57.441 [info] Collecting pycparser (from cffi>=1.14.6->raylib->gui==0.0.1)
2024-04-05 17:20:57.773 [info]   Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.22-py3-none-any.whl (117 kB)
2024-04-05 17:20:57.914 [info] Downloading cffi-1.16.0-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (466 kB)
2024-04-05 17:20:58.101 [info]    ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 466.6/466.6 kB 2.9 MB/s eta 0:00:00
2024-04-05 17:20:58.102 [info] 
2024-04-05 17:20:58.113 [info] Using cached charset_normalizer-3.3.2-cp311-cp311-manylinux_2_17_aarch64.manylinux2014_aarch64.whl (136 kB)
2024-04-05 17:20:58.171 [info] Building wheels for collected packages: gui, raylib
2024-04-05 17:20:58.176 [info]   Building editable for gui (pyproject.toml): started
2024-04-05 17:20:59.728 [info]   Building editable for gui (pyproject.toml): finished with status 'done'
2024-04-05 17:20:59.729 [info]   Created wheel for gui: filename=gui-0.0.1-0.editable-py3-none-any.whl size=2802 sha256=f0ce59ab8eaf54684a2f26891a9cc0c44a88be6dfbc18af9dc8eea97eeb98578
2024-04-05 17:20:59.730 [info]   Stored in directory: /tmp/pip-ephem-wheel-cache-mbb4t480/wheels/d6/87/9e/67439bcbc83b3961e3c4c3fbe4e53bc35163e706f6dc7b0cb9
2024-04-05 17:20:59.761 [info]   Building wheel for raylib (pyproject.toml): started
2024-04-05 17:21:00.936 [info]   Building wheel for raylib (pyproject.toml): finished with status 'done'
2024-04-05 17:21:00.942 [info]   Created wheel for raylib: filename=raylib-5.0.0.1-cp311-cp311-linux_aarch64.whl size=79454 sha256=a52e29b7cad93afaed81242005a64cd977781b68909309c8b98a84148712d285
2024-04-05 17:21:00.946 [info]   Stored in directory: /home/pi/.cache/pip/wheels/5f/ad/26/034df0d4c6eeb82f87ec7e4e608183c0b742dcf19cd0d924d3
2024-04-05 17:21:00.962 [info] Successfully built gui raylib
2024-04-05 17:21:01.424 [info] Installing collected packages: urllib3, pycparser, inflection, idna, charset-normalizer, certifi, requests, cffi, raylib, gui
2024-04-05 17:21:04.867 [info] Successfully installed certifi-2024.2.2 cffi-1.16.0 charset-normalizer-3.3.2 idna-3.6 inflection-0.5.1 gui-0.0.1 pycparser-2.22 raylib-5.0.0.1 requests-2.31.0 urllib3-2.2.1
2024-04-05 17:21:05.984 [info] CREATE_VENV.PIP_INSTALLED_PYPROJECT
raspberrypisig commented 2 months ago

also tried it with python 3.9 with raylib==4.2.1.2 . Same error.

my /boot/config.txt

# For more options and information see
# http://rpf.io/configtxt
# Some settings may impact device functionality. See link above for details

# uncomment if you get no picture on HDMI for a default "safe" mode
#hdmi_safe=1

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
#overscan_left=16
#overscan_right=16
#overscan_top=16
#overscan_bottom=16

# uncomment to force a console size. By default it will be display's size minus
# overscan.
#framebuffer_width=1280
#framebuffer_height=720

# uncomment if hdmi display is not detected and composite is being output
hdmi_force_hotplug=1

# uncomment to force a specific HDMI mode (this will force VGA)
#hdmi_group=1
#hdmi_mode=1

# uncomment to force a HDMI mode rather than DVI. This can make audio work in
# DMT (computer monitor) modes
#hdmi_drive=2

# uncomment to increase signal to HDMI, if you have interference, blanking, or
# no display
#config_hdmi_boost=4

# uncomment for composite PAL
#sdtv_mode=2

#uncomment to overclock the arm. 700 MHz is the default.
#arm_freq=800

# Uncomment some or all of these to enable the optional hardware interfaces
dtparam=i2c_arm=on
#dtparam=i2s=on
#dtparam=spi=on

# Uncomment this to enable infrared communication.
#dtoverlay=gpio-ir,gpio_pin=17
#dtoverlay=gpio-ir-tx,gpio_pin=18

# Additional overlays and parameters are documented /boot/overlays/README

# Enable audio (loads snd_bcm2835)
dtparam=audio=on

# added by raspberrypisig
initramfs initramfs-btrfs
dtparam=sd_poll_once=on

[pi4]
# Enable DRM VC4 V3D driver on top of the dispmanx display stack
dtoverlay=vc4-fkms-v3d
max_framebuffers=2
arm_64bit=1

[all]
#dtoverlay=vc4-fkms-v3d
electronstudio commented 2 months ago

Did you follow the instructions at https://electronstudio.github.io/raylib-python-cffi/RPI.html#option-2-compile-raylib-from-source-x11-mode ?

electronstudio commented 2 months ago

If yes, then there must be an error during the build that isn't being printed out by pip. Follow these instructions to do everything manually:

https://electronstudio.github.io/raylib-python-cffi/BUILDING.html#linux-manual-build

electronstudio commented 2 weeks ago

I have published binary wheels for 5.0.0.2 (Raspberry Bullseye 64bit X11). I'd be interested to hear if they work.