Skip to main content

DepthAI Python Library

Project description

DepthAI Python Library

License: MIT Python Wheel CI

Python bindings for C++ depthai-core library

Documentation

Documentation is available over at Luxonis DepthAI API

Installation

Prebuilt wheels are available in Luxonis repository Make sure pip is upgraded

python3 -m pip install -U pip
python3 -m pip install --extra-index-url https://artifacts.luxonis.com/artifactory/luxonis-python-snapshot-local/ depthai

Building from source

Dependencies

  • cmake >= 3.4
  • C++14 compiler (clang, gcc, msvc, ...)
  • Python

Along these, dependencies of depthai-core are also required See: depthai-core dependencies

Building

To build a shared library from source perform the following:

mkdir build && cd build
cmake ..
cmake --build . --parallel

To build a wheel, execute the following

python3 -m pip wheel . -w wheelhouse

Tested platforms

  • Windows 10
  • Ubuntu 16.04, 18.04;
  • Raspbian 10;
  • macOS 10.14.6, 10.15.4;

Troubleshooting

Relocation link error

Build failure on Ubuntu 18.04 ("relocation ..." link error) with gcc 7.4.0 (default) - issue #3

  • the solution was to upgrade gcc to version 8:

    sudo apt install g++-8
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-8 70
    sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-8 70
    

Hunter

Hunter is a CMake-only dependency manager for C/C++ projects.

If you are stuck with error message which mentions external libraries (subdirectory of .hunter) like the following:

/usr/bin/ld: /home/[user]/.hunter/_Base/062a19a/ccfed35/a84a713/Install/lib/liblzma.a(stream_flags_decoder.c.o): warning: relocation against `lzma_footer_magic' in read-only section `.text'

Try erasing the Hunter cache folder.

Linux/MacOS:

rm -r ~/.hunter

Windows:

del C:/.hunter

or

del C:/[user]/.hunter

LTO - link time optimization

If following message appears:

lto1: internal compiler error: in add_symbol_to_partition_1, at lto/lto-partition.c:152
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-10/README.Bugs> for instructions.
lto-wrapper: fatal error: /usr/bin/c++ returned 1 exit status
compilation terminated.
/usr/bin/ld: error: lto-wrapper failed
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/depthai.dir/build.make:227: depthai.cpython-38-x86_64-linux-gnu.so] Error 1
make[1]: *** [CMakeFiles/Makefile2:98: CMakeFiles/depthai.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

One fix is to update linker: (In case you are on Ubuntu 20.04: /usr/bin/ld --version: 2.30)

# Add to the end of /etc/apt/sources.list:

echo "deb http://ro.archive.ubuntu.com/ubuntu groovy main" >> /etc/apt/sources.list

# Replace ro with your countries local cache server (check the content of the file to find out which is)
# Not mandatory, but faster

sudo apt update
sudo apt install binutils

# Should upgrade to 2.35.1
# Check version:
/usr/bin/ld --version
# Output should be: GNU ld (GNU Binutils for Ubuntu) 2.35.1
# Revert /etc/apt/sources.list to previous state (comment out line) to prevent updating other packages.
sudo apt update

Another option is to use clang compiler:

sudo apt install clang-10
mkdir build && cd build
CC=clang-10 CXX=clang++-10 cmake ..
cmake --build . --parallel

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

depthai-2.0.0.0.tar.gz (227.1 kB view hashes)

Uploaded Source

Built Distributions

depthai-2.0.0.0-cp39-cp39-win_amd64.whl (31.6 MB view hashes)

Uploaded CPython 3.9 Windows x86-64

depthai-2.0.0.0-cp39-cp39-win32.whl (27.4 MB view hashes)

Uploaded CPython 3.9 Windows x86

depthai-2.0.0.0-cp39-cp39-manylinux2014_x86_64.whl (5.0 MB view hashes)

Uploaded CPython 3.9

depthai-2.0.0.0-cp39-cp39-macosx_10_9_x86_64.whl (4.5 MB view hashes)

Uploaded CPython 3.9 macOS 10.9+ x86-64

depthai-2.0.0.0-cp38-cp38-win_amd64.whl (31.6 MB view hashes)

Uploaded CPython 3.8 Windows x86-64

depthai-2.0.0.0-cp38-cp38-win32.whl (27.4 MB view hashes)

Uploaded CPython 3.8 Windows x86

depthai-2.0.0.0-cp38-cp38-manylinux2014_x86_64.whl (5.0 MB view hashes)

Uploaded CPython 3.8

depthai-2.0.0.0-cp38-cp38-macosx_10_9_x86_64.whl (4.5 MB view hashes)

Uploaded CPython 3.8 macOS 10.9+ x86-64

depthai-2.0.0.0-cp37-cp37m-win_amd64.whl (31.4 MB view hashes)

Uploaded CPython 3.7m Windows x86-64

depthai-2.0.0.0-cp37-cp37m-win32.whl (27.2 MB view hashes)

Uploaded CPython 3.7m Windows x86

depthai-2.0.0.0-cp37-cp37m-manylinux2014_x86_64.whl (5.0 MB view hashes)

Uploaded CPython 3.7m

depthai-2.0.0.0-cp37-cp37m-macosx_10_9_x86_64.whl (4.5 MB view hashes)

Uploaded CPython 3.7m macOS 10.9+ x86-64

depthai-2.0.0.0-cp37-cp37m-linux_armv7l.whl (5.8 MB view hashes)

Uploaded CPython 3.7m

depthai-2.0.0.0-cp36-cp36m-win_amd64.whl (31.4 MB view hashes)

Uploaded CPython 3.6m Windows x86-64

depthai-2.0.0.0-cp36-cp36m-win32.whl (27.2 MB view hashes)

Uploaded CPython 3.6m Windows x86

depthai-2.0.0.0-cp36-cp36m-manylinux2014_x86_64.whl (5.0 MB view hashes)

Uploaded CPython 3.6m

depthai-2.0.0.0-cp36-cp36m-macosx_10_9_x86_64.whl (4.5 MB view hashes)

Uploaded CPython 3.6m macOS 10.9+ x86-64

depthai-2.0.0.0-cp35-cp35m-win_amd64.whl (31.4 MB view hashes)

Uploaded CPython 3.5m Windows x86-64

depthai-2.0.0.0-cp35-cp35m-win32.whl (27.2 MB view hashes)

Uploaded CPython 3.5m Windows x86

depthai-2.0.0.0-cp35-cp35m-manylinux2014_x86_64.whl (5.0 MB view hashes)

Uploaded CPython 3.5m

depthai-2.0.0.0-cp35-cp35m-macosx_10_9_x86_64.whl (4.5 MB view hashes)

Uploaded CPython 3.5m macOS 10.9+ x86-64

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page