I wanted to run some python code which uses fuzzy logic on a Raspberry Pi 5.
Therefore I had to call the skfuzzy/scifuzzy library to do that - from there the problem seemed to occur. It seems like Raspberry Pi by default doesn't support it - nor does the alternative like simpful, the message was that,
error: externally-managed-environment
Hence I opted to set up a Virtual Environment and then install the module there.
sudo apt install -y python3-venv build-essential python3-dev libatlas-base-dev gfortran
In that skfuzzy module was downloaded- no problem. Other dependencies were also installed.
From there, a new problem seemed to occur - GPIO was incompatible with Raspberry Pi 5 - searching Raspberry Pi Stack Exchange, it seems like it was a thing. Although earlier, before setting up the virtual environment, we didn't encounter the error before.
The error message flashed:
File "/home/hp/your_script.py", line 12, in <module>
GPIO.setup(PUL, GPIO.OUT)
RuntimeError: Cannot determine SOC peripheral base address
Other alternatives to GPIO module like lgpio, gpiod, pigpio or pylibgpiod...
ERROR: No matching distribution found for pylibgpiod
also didn't seem to work.
Alternatively tried installing Linux sysfs interface. Didn't work either.
The Raspberry Pi 5 was running Debian GNU/Linux 12 (Bookworm). So maybe that's why it has the following problem:
Missing Device Tree: Without bcm2712-rpi-5-b.dtb or a functional /proc/device-tree/, the GPIO controller (gpio@400d0000) isn’t initialized, making all GPIOs invalid.
Unconfigured Pins: Lack of dtparam=gpio=20=op and dtparam=gpio=21=op means the pins may be reserved or disabled.
Potential Kernel Issue: If CONFIG_OF is disabled, the kernel can’t parse the device tree, breaking GPIO support.
Therefore I ran the command:
sudo apt install raspberrypi-bootloader raspberrypi-kernel
At this point the system crashed, I has to reinstall the OS again.
So, my question is how do I run the code which uses fuzzy logic?