Pi-top SDK issue on Raspberry Pi OS

I have encountered an issue with installing the pi-top SDK on Raspberry Pi OS. well it installs perfectly fine but the pt-sys-oled service has an issue starting.

Looking at the daemon.log it shows this

Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]: Traceback (most recent call last):
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:   File "/usr/lib/pt-sys-oled/pt-sys-oled", line 21, in <module>
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:     from pitop.system.device import device_type
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:   File "/usr/lib/python3/dist-packages/pitop/__init__.py", line 36, in <module>
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:     from .camera import Camera
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:   File "/usr/lib/python3/dist-packages/pitop/camera/__init__.py", line 1, in <module>
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:     from .camera import Camera
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:   File "/usr/lib/python3/dist-packages/pitop/camera/camera.py", line 1, in <module>
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:     from .core import UsbCamera
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:   File "/usr/lib/python3/dist-packages/pitop/camera/core/__init__.py", line 8, in <module>
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:     from .capture_actions import (
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:   File "/usr/lib/python3/dist-packages/pitop/camera/core/capture_actions/__init__.py", line 5, in <module>
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:     from .motion_detector import MotionDetector
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:   File "/usr/lib/python3/dist-packages/pitop/camera/core/capture_actions/motion_detector.py", line 5, in <module>
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:     from pitop.processing.core.vision_functions import import_opencv
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:   File "/usr/lib/python3/dist-packages/pitop/processing/core/vision_functions.py", line 2, in <module>
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:     from imutils import grab_contours
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:   File "/usr/lib/python3.7/dist-packages/imutils/__init__.py", line 8, in <module>
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:     from .convenience import translate
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:   File "/usr/lib/python3.7/dist-packages/imutils/convenience.py", line 6, in <module>
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]:     import cv2
Jun  4 19:46:57 pitopIOT pt-sys-oled[16807]: ModuleNotFoundError: No module named 'cv2'
Jun  4 19:46:57 pitopIOT systemd[1]: pt-sys-oled.service: Main process exited, code=exited, status=1/FAILURE
Jun  4 19:46:57 pitopIOT systemd[1]: pt-sys-oled.service: Failed with result 'exit-code'.
Jun  4 19:46:58 pitopIOT systemd[1]: pt-sys-oled.service: Service RestartSec=100ms expired, scheduling restart.
Jun  4 19:46:58 pitopIOT systemd[1]: pt-sys-oled.service: Scheduled restart job, restart counter is at 5.
Jun  4 19:46:58 pitopIOT systemd[1]: Stopped pi-top OLED system menu.
Jun  4 19:46:58 pitopIOT systemd[1]: pt-sys-oled.service: Start request repeated too quickly.
Jun  4 19:46:58 pitopIOT systemd[1]: pt-sys-oled.service: Failed with result 'exit-code'.
Jun  4 19:46:58 pitopIOT systemd[1]: Failed to start pi-top OLED system menu.

Any ideas on how to fix it?

Ok i figured out the issue. @duwudi @pi-topMIKE you may want to add the following to the SDK dependencies, as after running that command it worked perfectly

sudo python3.7 -m pip install opencv-python

just for a note, i installed the SDK from the info here

I have captured this bug here: https://github.com/pi-top/pi-top-Python-SDK/issues/363

1 Like

i installed the SDK on a headless install and found that i had to install more than just openCV

sudo python3 -m pip install opencv-python
sudo apt install -y libopenjp2-7 libilmbase-dev libopenexr-dev libgstreamer1.0-dev libavcodec-dev libavformat-dev libswscale-dev

i added this info to the GitHub issue

1 Like

The right solution here I think is sudo apt install -y python3-opencv, which should handle the other dependencies that it needs for you.

I did install opencv before installing the SDK and had to install these too

Right, but you installed a different version of OpenCV by virtue of pip installing it. I don’t think that these extra packages are necessary unless you’re specifically intending to use that version of OpenCV.

looks like that’s what it was