Closed notbored closed 1 year ago
If it’s the same issue as https://github.com/electronstudio/raylib-python-cffi/issues/63 then it’s fixed in master. You can either build from master or wait until I do a release.
I did a pre-release, please try
python3 -m pip install raylib==4.1.0.0.dev0
I assume this is fixed by python3 -m pip install raylib==4.1.0.0.dev2
, if not please reopen.
Sorry for late response but I've got I've got a different problem when I try and run anything I get:
raceback (most recent call last):
File "/Users/me/test/test.py", line 1, in <module>
from pyray import *
File "/opt/homebrew/lib/python3.10/site-packages/pyray/__init__.py", line 15, in <module>
from raylib import rl, ffi
File "/opt/homebrew/lib/python3.10/site-packages/raylib/__init__.py", line 15, in <module>
from ._raylib_cffi import ffi, lib as rl
ImportError: dlopen(/opt/homebrew/lib/python3.10/site-packages/raylib/_raylib_cffi.abi3.so, 2): no suitable image found. Did find:
/opt/homebrew/lib/python3.10/site-packages/raylib/_raylib_cffi.abi3.so: mach-o, but wrong architecture
/opt/homebrew/lib/python3.10/site-packages/raylib/_raylib_cffi.abi3.so: mach-o, but wrong architecture
If I uninstall raylib
and install raylib-dynamic
everything works but as soon as I install the normal version it stops working again so for now the only working option is to use dynamic.
The 4.2.0 release was messed up, I'm going to put out a new one. It probably won't solve this, but wait for that before trying again. What version of MacOS are you on?
Is your Python build arm64 or universal? Run python
and copy the output.
When you pip install raylib
exactly what wheel does it download and install?
I'm going to make the Macos12 arm64 binary a fat universal binary. It might help with this.
OK please answer questions above and then try raylib==4.2.1.0 which will be available in about 3 minutes from now.
I'm on an M1 Macbook and on Big Sur.
Python 3.10.6 (main, Aug 11 2022, 13:37:17) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
Just installed 4.2.1.0 via pip but again same error regarding wrong architecture.
from pyray import *
File "/opt/homebrew/lib/python3.10/site-packages/pyray/__init__.py", line 15, in <module>
from raylib import rl, ffi
File "/opt/homebrew/lib/python3.10/site-packages/raylib/__init__.py", line 15, in <module>
from ._raylib_cffi import ffi, lib as rl
ImportError: dlopen(/opt/homebrew/lib/python3.10/site-packages/raylib/_raylib_cffi.abi3.so, 2): no suitable image found. Did find:
/opt/homebrew/lib/python3.10/site-packages/raylib/_raylib_cffi.abi3.so: mach-o, but wrong architecture
/opt/homebrew/lib/python3.10/site-packages/raylib/_raylib_cffi.abi3.so: mach-o, but wrong architecture
Hmm it doesn't say the arch of your Python. Must be some way to get it.
What is name the of the wheel file that is downloaded when you pip install?
using pip show raylib
Name: raylib
Version: 4.2.1.0
Summary: Python CFFI bindings for Raylib
Home-page: https://github.com/electronstudio/raylib-python-cffi
Author: Electron Studio
Author-email: github@electronstudio.co.uk
License: EPL-2.0
Location: /opt/homebrew/lib/python3.10/site-packages
Requires: cffi, inflection
Required-by:
Sorry never had any issues like this before or with Python ever so not much experience or help to offer.
I need the output from pip install raylib
file /opt/homebrew/bin/python3
/opt/homebrew/bin/python3: Mach-O 64-bit executable arm64
This what you wanted?
It’s going to download and install one of these files and I suspect it’s downloading the wrong one. https://pypi.org/project/raylib/#files
pip install raylib
Collecting raylib
Using cached raylib-4.2.1.0-cp310-cp310-macosx_11_0_arm64.whl (1.0 MB)
Requirement already satisfied: inflection in /opt/homebrew/lib/python3.10/site-packages (from raylib) (0.5.1)
Requirement already satisfied: cffi>=1.14.6 in /opt/homebrew/lib/python3.10/site-packages (from raylib) (1.15.1)
Requirement already satisfied: pycparser in /opt/homebrew/lib/python3.10/site-packages (from cffi>=1.14.6->raylib) (2.21)
Installing collected packages: raylib
Successfully installed raylib-4.2.1.0
Thanks. Looks like your Python is arm64. And it’s downloading the arm64 binary. But it’s saying wrong arch. Can you try
file /opt/homebrew/lib/python3.10/site-packages/raylib/_raylib_cffi.abi3.so
please. The only other thing is that I believe the Python builds from Python.org are universal, not arm64, so would be interesting to see if it works with them.
/opt/homebrew/lib/python3.10/site-packages/raylib/_raylib_cffi.abi3.so: Mach-O 64-bit bundle x86_64
OK I think what happened is that Github Actions used to supply universal Python, so the builds I did worked. But recently they changed to only supplying x86 Python, so the recent builds are being compiled as x86. Not sure how to fix it yet. Might be simpler just to remove all binary builds for Mac.
Can you try doing a source build, just to make sure that works? You'll need raylib installed (homebrew version should work, but if not manual install instructions are here https://github.com/electronstudio/raylib-python-cffi/blob/master/BUILDING.rst )
Then
pip3 install --no-binary raylib --upgrade --force-reinstall raylib
Working! Appreciate the time and help!
For others coming to this, and skimming, you just need to:
brew install raylib
pip3 install --no-binary raylib --upgrade --force-reinstall raylib
ok i've removed the arm64 wheels, so pip should now do the source build by default.
installed via
pip install raylib
, also have raylib installed via homebrew.