Pi4 setup with Oak-D-Lite camera

I’m tying and failing to get my Raspberry Pi 4 B setup with Oak-D-Lite camera as per the online guide (Integrated Computer Vision Package - OAK-D Lite With Raspberry Pi Set Up - Tutorial Australia) which uses Debian Bullseye. I was previously helped over my first hurdle (a missing shared object) by Zach. I last received an email from Aaron suggesting I try Bookworm instead, and deal using a python virtual environment there. I did get a Debian bookworm image, and created a virtual environment, and tried commands from the guide, but again get stopped with the error about packages are externally managed. Now it seems to want me to create a new virtual environment, although I’m already in one. I notice that the PATH does contain the bin directory within the path for the created virtual environment, so obviously the python executable runs as expected. I’m hoping I don’t need nested virtual environments, but stuck at the moment.

The error you’re seeing usually happens when Python packages are being managed at the system level, often due to the use of a system-wide Python package manager. If you’re using Debian Bookworm, Python might be managed by apt as a system package. It can cause issues in the virtual environment.

Thanks. I might not fully understand though. My current understanding is that pip is the python package manager. FYI, my version of python is 3.11.2. (pip is 23.0.1) I see the output associated with the error also suggests that apt install could be used as long as the package name has the prefix “python3-”. But I don’t know exactly what is causing the error. I’m attempting to run depthai-python/examples/install_requirements.py but don’t get to see what package usage is being attempted that causes the error, so I don’t know what to put with apt install. The error content also states "If you wish to install a non-Debian-packaged Python package…, Make
sure you have python3-full installed.
". I found at Debian -- Details of package python3-full in sid that "This package depends on Debian’s default python 3 version’s full standard library (currently v3.12). So now update to python 3.12, or 3.13, I guess.

"

Hi @Lee283496, Welcome to the forums!!!

For some additional context, this is the post about installing DepthAI on Bookworm/Pi 5

If you could let us know where in the installation steps you are getting the errors that could be helpful in troubleshooting the issue. Screenshots of your terminal may also help with this as well.

To update context (sorry if I misled you somehow previously) I’m actually trying with the Pi4 model B. Initially I used Debian Bullseye, because that was what the guide was showing. Now I’m using Bookworm. With Bullseye I had got past the RGB preview to the point of being able to view the image with object classification and bounds box. I will post back here after my next attempt with Bookworm(The 2.9G image on a new card) where uname -a shows Linux raspberrypi 6.6.51+rpt-rpi-v8 #1 SMP PREEMPT Debian 1:6.6.51-1+rpt3 (2024-10-08) aarch64 GNU/Linux, and python version is 3.11.2.

Oh well, I have captured terminal output of my latest attempt, but it’s too much to post here.

Hi @Lee283496,

If you can let us know at what point in the instructions you are having issues we may be able to help you out.

I just quickly went through the instructions on one of our Pi 4 here and all the steps were successful so the instructions do work.

It stops during the depthai-python/examples/install_requirements.py, with error about externally managed environment. The output shows “pip 23.0.1 from /usr/lib/python3/dist-packages/pip (python 3.11)
error: externally-managed-environment”. I also tried after apt install python-depthai, and in a virtual environment. I’ve captured terminal output of trying things for a couple of minutes, but it’s too many characters to fit in a post here (limited to 2000). I can supply a text file, if allowed.

1 Like

Hey @Lee283496,

It sounds like it could be an issue with the environment in which this command is run.

When you run this command what prompt do you see before your text field?

It should look something like this (env) user@host:~$

If this looks correct (feel free to send it to us for confirmation) try updating setuptools inside of this environment before you run install_requirements.py to see if that helps.

pip install --upgrade pip setuptools
before
python3 install_requirements.py

Feels free to send us the output as a text file if you can, otherwise a google drive link or similar would also work.

Hope this helps! :slight_smile:

Hi. Thanks for the reply. The terminal has what I believe to be the correct prompt (being the virtual environment name in brackets, prior to the typical prompt. I have captured the entire terminal output, and put it at https://drive.google.com/file/d/10WWjf8ER6er90L-6Yt9Zd3JoycXsbqG0/view?usp=drive_link

This link is currently private. You may need to set it to public for us to be able to view.

Also want to clarify here as well. Are following along with the Core electronics Guide or the Bookworm Guide when this occurs?

I made the terminal trace file share to anybody with the link. I’ve been following the guide at Integrated Computer Vision Package - OAK-D Lite With Raspberry Pi Set Up - Tutorial Australia. First with Bullseye, where I got to the point of the video image showing identified objects, but no GUI in the demo. So I tried Bookworm, where I got stuck in the way discussed so far.

Hi @Lee283496,

Having a look through the trace it looks like you’re issues are coming from not setting the virtual environment properly.

I’d recommend starting with a clean install of Pi OS Bookworm and ensuring it’s up to date with sudo apt update and sudo apt upgrade

The following steps worked for me on both a Pi 4 and Pi 5 running bookworm

  1. Setup_USB_Rules.sh (Can just be copied line by line into terminal)
#/bin/bash

echo 'SUBSYSTEM=="usb", ATTRS{idVendor}=="03e7", MODE="0666"' | sudo tee /etc/udev/rules.d/80-movidius.rules

sudo udevadm control --reload-rules && sudo udevadm trigger

echo -e "RULES LOADED - NOW DISCONNECT AND RECONNECT THE USB CABLE TO THE OAK-D-LITE"
  1. Setup the Python Virtual Environment:
python3 -m venv --system-site-packages vdepthai
  1. Install Dependencies (Run one line at a time )
cd [path to vdepthai folder]

You can find it by copying the path from the folder in your user folder.

git clone https://github.com/luxonis/depthai.git
source bin/activate

After its activated your the terminal lines should start with (vdepthai) to show its active
This is important to ensure when installing packages and running the software

pip3 install opencv-python opencv-contrib-python
cd depthai
python3 install_requirements.py 
  1. Try running the program:
python3 depthai_demo.py

If you are still having trouble please share screenshot (Print Sreen button on your keyboard and saved to the pictures folder on the Pi) of where you are getting stuck.

Thanks. I did all you said, and got to where the image with object classifications and bounds drawn, and separately, the disparity view. This is also the best result I had when I was using Bullseye. I don’t get a GUI, as indicated in the guide that I was following previously. I suspect that it may be dependent upon Qt, and that dependency might not be fully met. Here is terminal output: (vdepthai) lee@raspberrypi:~/vdepthai/depthai $ python3 depthai_demo.py /home/lee/vdepthai/lib/python3.11/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (5.1.0)/charset_normalizer (2.0.12) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " Using depthai module from: /home/lee/vdepthai/lib/python3.11/site-packages/depthai.cpython-311-aarch64-linux-gnu.so Depthai version installed: 2.24.0.0 /home/lee/vdepthai/lib/python3.11/site-packages/requests/__init__.py:102: RequestsDependencyWarning: urllib3 (1.26.12) or chardet (5.1.0)/charset_normalizer (2.0.12) doesn't match a supported version! warnings.warn("urllib3 ({}) or chardet ({})/charset_normalizer ({}) doesn't match a supported " Setting up demo... Available devices: [0] 14442C1041B442D400 [X_LINK_UNBOOTED] USB Connection speed: UsbSpeed.SUPER Downloading /home/lee/.cache/blobconverter/mobilenet-ssd_openvino_2021.4_6shave.blob... [==================================================] Done qt.qpa.plugin: Could not find the Qt platform plugin "wayland" in "/home/lee/vdepthai/lib/python3.11/site-packages/cv2/qt/plugins"

[quote=“Lee283496, post:14, topic:21255”]
Actually, I found this problem discussed on stackoverflow.com as a known issue with opencv… stated " [

Qt and opencv app not working in virtual environment

[image]
Stack Overflow
https://stackoverflow.com › questions › qt-and-opencv-…
](python - Qt and opencv app not working in virtual environment - Stack Overflow)

The problem is that the version of Qt with which opencv was compiled is not similar to the one used by PyQt5 causing a conflict.

1 Like

Hey @Lee283496,

That sounds frustrating but at least it is a known issue.

Have you make any progress getting around this?

[quote=“Aaron, post:13, topic:21255”]
I didn’t resolve the issue. I’ve started again with a fresh PiOS (Bookworm 2.9G image via Pi Imager) I get an error from pip3 install for the opencv packages (pip3 install opencv-python opencv-contrib-python), after activating the virtual environment. The error is “ERROR: Could not install packages due to an OSError: [Errno 28] No space left on device” This is unexpected, as I have a 16G SD card. But I continued ith attempting to run the install_re
quirements.py. It had some errors, and skipped some things. The terminal output is at https://drive.google.com/file/d/1b64U0NpqGxyDMQorxScI_LFbmPYFjZzt/view?usp=drive_link

1 Like

Hey @Lee283496,

It would be odd for that SD card to be full but its not impossible. I would try the following to rule this out as the problem:

  • Check the current disk usage on your Raspbian by typing the following command in terminal: df -h
  • If you recently flashed PiOS onto your SD card, there are chances that it might not be using all the available space. You can expand your filesystem to utilize all available space on your SD by running: sudo raspi-config Go to Advanced Options -> Expand Filesystem.

Let us know how that goes and we can continue from there! :slight_smile:

Ok. I got a 32G SD card and got to the point I’ve been a couple of times previously. That is camera colour image with object bounding boxes and classification, but no GUI as shown in the guide I’ve mentioned previously.

Hey @Lee283496,

So to confirm, transferring to a 32GB card has not changed anything? If so, it’s almost definitely not an SD card issue.

Have you tried the steps that sam outlined in his post from yesterday? If so, how did it go?