hhk7734 / Odroid.GPIO

Odroid.GPIO
MIT License
6 stars 1 forks source link

ImportError: libwiringPi.so.3: cannot open shared object file: No such file or directory #6

Open Matebo opened 1 year ago

Matebo commented 1 year ago

I have a new Odroid C4 and some python code that was originally written for Raspberry Pi. I changed import RPi.GPIO to import Odroid.GPIO and followed the installation requirements from the readme. I get stuck on on ImportError: libwiringPi.so.3: cannot open shared object file: No such file or directory. Any suggestions?

From installation to ImportError

(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API/API$ sudo add-apt-repository -y ppa:hardkernel/ppa \
> && sudo apt update
Hit:1 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:3 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Hit:5 http://ppa.launchpad.net/hardkernel/ppa/ubuntu bionic InRelease
Hit:6 http://ppa.launchpad.net/hardkernel/ppa/ubuntu focal InRelease
Hit:7 http://archive.canonical.com/ubuntu focal InRelease
Get:8 http://deb.odroid.in/c4 focal InRelease [1714 B]
Fetched 1714 B in 2s (745 B/s)
Reading package lists... Done
Hit:1 http://archive.canonical.com/ubuntu focal InRelease
Hit:2 http://ports.ubuntu.com/ubuntu-ports focal InRelease
Hit:3 http://ppa.launchpad.net/hardkernel/ppa/ubuntu bionic InRelease
Hit:4 http://ports.ubuntu.com/ubuntu-ports focal-updates InRelease
Hit:5 http://ports.ubuntu.com/ubuntu-ports focal-backports InRelease
Hit:6 http://ports.ubuntu.com/ubuntu-ports focal-security InRelease
Hit:7 http://ppa.launchpad.net/hardkernel/ppa/ubuntu focal InRelease
Get:8 http://deb.odroid.in/c4 focal InRelease [1714 B]
Fetched 1714 B in 3s (579 B/s)
Reading package lists... Done
Building dependency tree
Reading state information... Done
4 packages can be upgraded. Run 'apt list --upgradable' to see them.
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API/API$ sudo apt install -y python3 python3-dev python3-pip \
>     odroid-wiringpi libwiringpi-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
python3 is already the newest version (3.8.2-0ubuntu2).
python3-dev is already the newest version (3.8.2-0ubuntu2).
python3-pip is already the newest version (20.0.2-5ubuntu1.8).
libwiringpi-dev is already the newest version (3.14.5-0~202301030313~ubuntu20.04.1).
odroid-wiringpi is already the newest version (3.14.5-0~202301030313~ubuntu20.04.1).
0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API/API$ python3 -m pip install -U --user pip Odroid.GPIO
ERROR: Can not perform a '--user' install. User site-packages are not visible in this virtualenv.
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API/API$ python3 -m pip install -U pip Odroid.GPIO
Requirement already satisfied: pip in /home/ebo/tools/network-anomaly-api/relay_API/venv/lib/python3.8/site-packages (23.0.1)
Requirement already satisfied: Odroid.GPIO in /home/ebo/tools/network-anomaly-api/relay_API/venv/lib/python3.8/site-packages (0.1.4)
Requirement already satisfied: pybind11>=2.4 in /home/ebo/tools/network-anomaly-api/relay_API/venv/lib/python3.8/site-packages (from Odroid.GPIO) (2.10.3)
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API/API$ cd ..
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API$ python3 app.py
Traceback (most recent call last):
  File "app.py", line 25, in <module>
    from web_app import app
  File "/home/ebo/tools/network-anomaly-api/relay_API/web_app/__init__.py", line 53, in <module>
    from web_app.relay.routes import relay_blueprint
  File "/home/ebo/tools/network-anomaly-api/relay_API/web_app/relay/routes.py", line 15, in <module>
    from API.relay import Relay
  File "/home/ebo/tools/network-anomaly-api/relay_API/API/relay.py", line 6, in <module>
    import Odroid.GPIO as GPIO
  File "/home/ebo/tools/network-anomaly-api/relay_API/venv/lib/python3.8/site-packages/Odroid/GPIO/__init__.py", line 29, in <module>
    from Odroid._GPIO import *
ImportError: libwiringPi.so.3: cannot open shared object file: No such file or directory
(venv) ebo@odroid:~/tools/network-anomaly-api/relay_API$
Matebo commented 1 year ago

I have the same issue when running the example code

user@odroid:~/tools/blink-python$ cat app.py
import Odroid.GPIO as GPIO
# You can also use 'import RPi.GPIO as GPIO'.
import time

'''
GPIO.BCM == GPIO.SOC
GPIO.BOARD
GPIO.WIRINGPI
'''
GPIO.setmode(GPIO.BOARD)

GPIO.setup(13, GPIO.OUT)

while True:
    GPIO.output(13, GPIO.HIGH)
    time.sleep(1)
    GPIO.output(13, GPIO.LOW)
    time.sleep(1)
ebo@odroid:~/tools/blink-python$ python3 app.py
Traceback (most recent call last):
  File "app.py", line 1, in <module>
    import Odroid.GPIO as GPIO
  File "/usr/local/lib/python3.8/dist-packages/Odroid/GPIO/__init__.py", line 29, in <module>
    from Odroid._GPIO import *
ImportError: libwiringPi.so.3: cannot open shared object file: No such file or directory
user@odroid:~/tools/blink-python$
Matebo commented 1 year ago

We made a symbolic link from libwiringPi.so.3 to libwiringPi.so.2 in /usr/lib/aarch64-linux-gnu with

ln -s libwiringPi.so.2 libwiringPi.so.3
Matebo commented 1 year ago

I think it still needs a permanent fix