DepthAI can’t connect to an OAK camera

For USB OAK cameras, DepthAI can throw an error code like X_LINK_COMMUNICATION_NOT_OPEN or X_LINK_ERROR, which is usually a sign of a bad USB3 cable (or a USB2 cable). If you are using USB2 cable (and want USB2 bandwidth), you have to specify USB2 protocol, see Forcing USB2 Communication for more information. Another common issue is that users haven’t set udev rules on their Linux machine.

If you still can’t connect to the OAK camera, you should execute lsusb | grep 03e7. You should see a similar line:

$ lsusb | grep 03e7
Bus 001 Device 120: ID 03e7:2485 Intel Movidius MyriadX

Another thing to check is the dmesg -w. After executing that and pressing enter a few times (for separator), connect your OAK camera to the host. You should see a similar output in the terminal:

/~$ dmesg -w

[223940.862544] usb 1-3.2: new high-speed USB device number 120 using xhci_hcd
[223940.963357] usb 1-3.2: New USB device found, idVendor=03e7, idProduct=2485, bcdDevice= 0.01
[223940.963364] usb 1-3.2: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[223940.963368] usb 1-3.2: Product: Movidius MyriadX
[223940.963371] usb 1-3.2: Manufacturer: Movidius Ltd.
[223940.963373] usb 1-3.2: SerialNumber: 03e72485

If these commands didn’t return the expected log, please send us an email to

How can the start-up demo on the Raspberry Pi Compute Edition be disabled?

Delete the autostart file:

rm /home/pi/.config/autostart/runai.desktop

ImportError: No module named ‘depthai’

This indicates that the depthai was not found by your python interpreter. There are a handful of reasons this can fail:

  1. Is the Python API installed? Verify that it appears when you type:

    python3 -m pip list | grep depthai
  2. Are you using a supported platform for your operating system? If not, you can always install from source:

    cat /etc/os-release

Why is the Camera Calibration running slow?

Poor photo conditions can dramatically impact the image processing time) during the camera calibration. Under normal conditions, it should take 1 second or less to find the chessboard corners per-image on an Raspberry Pi but this exceed 20 seconds per-image in poor conditions. Tips on setting up proper photo conditions:

  • Ensure the checkerboard is not warped and is truly a flat surface. A high-quality option: print the checkerboard on a foam board.

  • Reduce glare on the checkerboard (for example, ensure there are no light sources close to the board like a desk lamp).

  • Reduce the amount of motion blur by trying to hold the checkerboard as still as possible.

Permission denied error

If python3 -m pip install fails with a Permission denied error, your user likely doesn’t have permission to install packages in the system-wide path.

[Errno 13] Permission denied: '/usr/local/lib/python3.7/dist-packages/...'

Try installing in your user’s home directory instead by adding the --user option. For example:

python3 -m pip install depthai --user

More information on Stackoverflow.

DepthAI does not show up under /dev/video* like web cameras do. Why?

The USB device enumeration could be checked with lsusb | grep 03e7 . It should print:

  • 03e7:2485 after reset (boot loader running)

  • 03e7:f63b after the application was loaded

No /dev/video* nodes are created.

DepthAI implements the VSC (Vendor Specific Class) protocol and libusb is used for communication.

Intermittent Connectivity with Long (2 meter) USB3 Cables

  • We’ve found that some hosts have trouble with USB3 + long cables (2 meter). It seems to have something to do with the USB controller on the host side.

  • Other hosts have no problem at all and run for days (tested well over 3 days on some), even with long cables (tested w/ a total length of a bit over 8 feet). For example, all Apple computers we’ve tested with have never exhibited the problem.

  • Ubuntu 16.04 has an independent USB3 issue, seemingly only on new machines though. We think this has to do w/ Ubuntu 16.04 being EOLed prior or around when these new machines having hit the market. For example, on this computer (here) has rampant USB3 disconnect issues under Ubuntu 16.04 (with a 1 meter cable), but has none under Ubuntu 18.04 (with a 1 meter cable).

So unfortunately we discovered this after we shipped with long USB3 cables (2 meter cables) with DepthAI units.

So if you have see this problem with your host, potentially 3 options:

  1. Switch to a shorter USB3 cable (say 1 meter) will very likely make the problem disappear. These 1 meter (3.3 ft.) cables are a nice length and are now what we ship with DepthAI USB3 variants.

  2. Force USB2 mode with --usbSpeed usb2 option (examples below). This will allow use of the long cable still, and many DepthAI use cases do not necessitate USB3 communication bandwidth - USB2 is plenty.

  3. Upgrade from Ubuntu 16.04 to Ubuntu 18.04.

Forcing USB2 Communication

If you aren’t using a (working) USB3 cable or your host computer doesn’t support USB3, you should force the USB2 communication. It’s also recommended to use USB2 communication if you are using a longer USB cable (2m+).

For API usage, set the usb2Mode=True when creating the device:

# Force USB2 communication
with dai.Device(pipeline, usb2Mode=True) as device:

If you are using depthai_demo you can specify USB speed with -usbs argument:

python3 -usbs usb2

Output from DepthAI keeps freezing

If the output from the device keeps freezing every few seconds, there may be a problem with the USB3 connection and forcing the device into USB2 mode could resolve this issue - instructions are in the chapter above.

When connection speed is USB2 (due to some hosts - Windows in particular - or USB controller/port/cable being USB2) - initialization of USB3-enabled firmware or streaming after a few frames may fail. The workaround here is to force the device to use the USB2-only firmware (mentioned in the chapter above).

Udev rules on Linux

  • Failed to boot the device: 1.3-ma2480, err code 3

  • Failed to find device (ma2480), error message: X_LINK_DEVICE_NOT_FOUND

  • [warning] skipping X_LINK_UNBOOTED device having name "<error>"

If you are getting any of the errors above, it’s most likely that udev rules are not set on your Linux machine.

To fix this, set the udev rules using the commands below, unplugging DepthAI and then plugging it back into USB afterwards.

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

CTRL-C Is Not Stopping It!

If you are trying to kill a program with CTLR-C, and it’s not working, try CTRL-\ instead. Usually this will work.

Is Your Raspberry Pi Locking Up or is DepthAI Crashing on Raspberry Pi?

The Raspberry Pi has a max limit of 1.2A across all its USB ports, and DepthAI/megaAI/OAK can take up to 1A (at max power, usually closer to 500mA).

So if you are seeing lockups, it could be that you are over this 1.2A limit as a result of the total power of the USB devices drawing from the Pi. Using a powered hub can prevent this, or powering fewer other things off of the Pi over USB.

This may also manifest in DepthAI randomly crashing on the Pi. This can become particularly often if DepthAI is configured to do many things at once. This is becoming increasingly likely as we enable DepthAI to do more and more things at once - and thereby increase the maximum power that DepthAI can pull. It is seeming like the peak power (current) spikes from DepthAI can go over what the Pi can handle, causing DepthAI to brown-out and return an error.

So if you are experiencing issues with DepthAI stability on Raspberry, try powering DepthAI via a power-supply and/or a powered USB hub to see if the error goes away.

“DLL load failed while importing cv2” on Windows

If you are seeing the following error after installing DepthAI for Windows:

(venv) C:\Users\Context\depthai>python
 Traceback (most recent call last):
   File "C:\Users\Context\depthai\", line 7, in <module>
     import cv2
   File "C:\Users\Context\depthai\venv\lib\site-packages\cv2\", line 5, in <module>
     from .cv2 import *
 ImportError: DLL load failed while importing cv2: The specified module could not be found.

Then installing the Windows Media Feature Pack (here) is often the resolution, as Media Feature Pack must be installed for Windows 10 N editions.

(And more background from OpenCV directly is here)

python3 returns Illegal instruction

This so far has always meant there is a problem with the OpenCV install on the host (and not actually with the depthai library). To check this, run:

python3 -c "import cv2; import numpy as np; blank_image = np.zeros((500,500,3), np.uint8); cv2.imshow('s', blank_image); cv2.waitKey(0)"

If a window is not displayed, or if you get the :bash: Illegal instruction result, this means there is a problem with the OpenCV install. The installation scripts here often will fix the OpenCV issues. But if they do not, running :bash: python3 -m pip install opencv-python –force-reinstall will often fix the OpenCV problem.

Neural network blob compiled with incompatible openvino version

[NeuralNetwork(2)] [error] Neural network blob compiled with incompatible openvino version. Selected openvino version 2020.3. If you want to select an explicit openvino version use: setOpenVINOVersion while creating pipeline

The reason for this error is that depthai can’t resolve the OpenVINO version from the blob. The solution is simple, the user has to specify the OpenVINO version with which the blob was compiled (as mentioned in the error message):

pipeline = depthai.Pipeline()
# Set the correct version:

“realloc(): invalid pointern Aborted” on RPi

On RPi, after running sudo apt upgrade, you might get the error realloc(): invalid pointer\n Aborted when importing cv2 after depthai library. We have observed the same issue, and have found a solution:

  • Downgrade libc6 by running sudo apt install -y --allow-downgrades libc6=2.28-10+rpi1, OR

  • Re-install DepthAI dependencies by running sudo curl -fL | bash

[error] Attempted to start camera - NOT detected!

If you are facing any of the errors above for either Mono Left/Right or Color camera, first try using the latest depthai version (python3 -mpip install depthai -U). If that doesn’t help, there are 2 probable causes:

  • You are using OAK FFC and a camera sensor that isn’t supported by default, so you should use a different branch, see docs here.

  • A camera got disconnected during the shipping. This has been reported only a handful of times, but it’s possible. The solution here is to open up the enclosure and re-attach the connector to the camera, see the image here for the OAK-D (left mono camera not detected).

[error] input tesnor exceeds available data range

[NeuralNetwork(3)] [error] Input tensor '0' (0) exceeds available data range. Data size (6336B), tensor offset (0), size (6912B) - skipping inference

This error is usually thrown when we use NNData message and we don’t provide the amount of bytes that the NN model expects for the inference. For example, in the error above, the NN model expects 6912 bytes (48x48x3), but only 6336 bytes were sent to it.

Got questions?

We’re always happy to help with code or other questions you might have.