I am using a macOS 12.2.1 with Python 3.10 and I am trying to install Raylib Python CFFI 3.7 or higher but whenever I run the `python3 -m pip install raylib` command or the `pip3 install raylib` command but I keep getting the error below:
generating cffi module 'build/temp.macosx-10.9-universal2-3.10/raylib._raylib_cffi.c'
building 'raylib._raylib_cffi' extension
build/temp.macosx-10.9-universal2-3.10/raylib._raylib_cffi.c:570:14: fatal error: 'raylib.h' file not found
#include "raylib.h"
^~~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit code 1
[end of output]
I tried several things to solve this issue but no luck.
What I have tried:
I tried installing other libraries by running these commands
pip3 install --upgrade setuptools
pip3 install ez_setup
python3 -m pip install --upgrade pip
pip install --upgrade setuptools
brew install pkg-config
brew install raylib
python3 -m pip install pyray
Then I was getting an error in the VideoService class on line 101 pyray.init_window(self.width, self.height, self.caption) basically that the function init_window() did not exist in pyray so I installed the raylib dynamic library by executing this command python3 -m pip install raylib_dynamic
So now I have the below list of libraries:
% pip list
Package Version
-------------- -------
cffi 1.15.0
ez-setup 0.9
inflection 0.5.1
pip 22.0.3
pycparser 2.21
pyray 0.1.0
raylib-dynamic 4.0.0.5
setuptools 60.8.2
Note that I already added the Artifact class code in the artifact.py file
And now I am getting this error when I run the game python3 rfk:
File "/Users/gibran/Documents/cse210-06/rfk/game/services/keyboard_service.py", line 1, in <module>
import pyray
File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyray/_init_.py", line 15, in <module>
from raylib import rl, ffi
ImportError: cannot import name 'rl' from 'raylib' (/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/raylib/_init_.py)
I installed rl by executing python3 -m pip install rl
Collecting rl
Downloading rl-3.0.zip (448 kB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 448.3/448.3 KB 7.8 MB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (from rl) (60.8.2)
Using legacy 'setup.py install' for rl, since package 'wheel' is not installed.
Installing collected packages: rl
Running setup.py install for rl ... done
Successfully installed rl-3.0
But no luck and installed python3 -m pip install raylib-py but no luck
% pip list
Package Version
-------------- -------
cffi 1.15.0
ez-setup 0.9
inflection 0.5.1
pip 22.0.3
pycparser 2.21
pyray 0.1.0
raylib-dynamic 4.0.0.5
raylib-py 0.1.1
rl 3.0
setuptools 60.8.2