Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

arcade-bonnet.sh install error on raspberry pi 5 with bookworm "externally managed environment" #313

Open
jareddonovan opened this issue May 13, 2024 · 2 comments
Labels

Comments

@jareddonovan
Copy link

jareddonovan commented May 13, 2024

Script Command

sudo bash arcade-bonnet.sh

Operating System

Raspberry Pi OS (64-bit) (debian bookworm) with raspberry pi desktop.

Hardware

Raspberry Pi 5

Behavior

An error occurs when I run the script:

error: externally-managed-environment

Otherwise, the script appears to exit as expected and copies the configuration files to the right places. However, when I reboot the Pi, and test the arcade buttons they do not work.

Description

The full output contains some additional information which may be useful:

error: externally-managed-environment

This environment is externally managed

To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

For more information visit http://rptl.io/venv

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

I selected following options when the script first runs:

  • disable overscan: N
  • install GPIO utility: N

Otherwise, it is a fresh install of the operating system (from the raspberry PI imager) with no other added libraries or changes.

Other notes:

  • I2C is enabled via raspi-config
  • I'm confident it's not a wiring/hardware issue because the same arcade bonnet works on a Pi4 running the previous OS (bullseye), which did not have the externally managed environment restriction.

Additional information

I believe the error arises at line 114. When I comment this line out and run the script, it does not give the error (but obviously still does not work):

pip3 install evdev smbus

I tried several things to fix this. I re-ran the script, rebooted and tested the buttons again after each one, but no luck:

  • I deleted the EXTERNALLY-MANAGED file in /usr/lib/python3.11
  • I set up a python virtual environment python3 -m venv venv
  • I the arcade-bonnet.sh script to use pipx instead of pip to install evdev and smbus libraries.
  • I edited the arcade-bonnet.sh script to use apt install python3-evdev and apt-install python3-smbus

With all these, the libraries appear to install fine, but the buttons still don't work.

@jareddonovan
Copy link
Author

jareddonovan commented May 13, 2024

Some further debugging notes

I used the journalctl command to look at the logs and found the following:

... rc.local[1411]: Traceback (most recent call last):
... rc.local[1411]:   File "/boot/arcadeBonnet.py", line 92, in <module>
... rc.local[1411]:     gpio.setup(irqPin, gpio.IN, pull_up_down=gpio.PUD_UP)
... rc.local[1411]: RuntimeError: Cannot determine SOC peripheral base address

Line 92, is I believe the second line below from arcadeBonnet.py, which gets installed to /boot by arcade-bonnet.sh

# Enable pullup and callback on MCP23017 IRQ pin
gpio.setup(irqPin, gpio.IN, pull_up_down=gpio.PUD_UP)

Based on that error, it seems that this might be related to some other issues people have reported for GPIO and the raspberry pi 5:

I will take a look at these and see if I can make any progress on a fix.

@jareddonovan
Copy link
Author

I think I have solved the issue by uninstalling the python3-rpi.gpio and installing python3-rpi-lgpio in its place, which is supposedly a drop in replacement.

sudo apt autoremove python3-rpi.gpio
sudo apt install python3-rpi-lgpio

I rebooted after this and the buttons and joystick work with an Arcade Bonnet and Raspberry Pi 5.

I'll leave it to the repo maintainer to close the issue in case you want to review and add this fix as a note for readers of the arcade bonnet software installation guide.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant