DepthAI Python Library
Project description
DepthAI Python Library
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, ...)
- Python3
Along these, dependencies of depthai-core are also required See: depthai-core dependencies
Building
To build and install using pip:
python3 -m pip install .
Add parameter -v
to see the output of the building process.
To build a wheel, execute the following
python3 -m pip wheel . -w wheelhouse
To build a shared library from source perform the following:
ℹ️ To speed up build times, use
cmake --build build --parallel [num CPU cores]
(CMake >= 3.12). For older versions use: Linux/macOS:cmake --build build -- -j[num CPU cores]
, MSVC:cmake --build build -- /MP[num CPU cores]
git submodule update --init --recursive
cmake -H. -Bbuild
cmake --build build
To specify custom Python executable to build for, use cmake -H. -Bbuild -D PYTHON_EXECUTABLE=/full/path/to/python
.
Running tests
To run the tests build the library with the following options
git submodule update --init --recursive
cmake -H. -Bbuild -D DEPTHAI_PYTHON_ENABLE_TESTS=ON -D DEPTHAI_PYTHON_ENABLE_EXAMPLES=ON -D DEPTHAI_PYTHON_TEST_EXAMPLES=ON
cmake --build build
Then navigate to build
folder and run ctest
cd build
ctest
To test a specific example/test with a custom timeout (in seconds) use following:
TEST_TIMEOUT=0 ctest -R "01_rgb_preview" --verbose
If TEST_TIMEOUT=0
, the test will run until stopped or it ends.
Tested platforms
- Windows 10
- Ubuntu 16.04, 18.04;
- Raspbian 10;
- macOS 10.14.6, 10.15.4;
Building documentation
-
Using Docker (with Docker Compose)
cd docs sudo docker-compose build sudo docker-compose up
ℹ️ You can leave out the
sudo
if you have added your user to thedocker
group (or are using rootless docker). Then open http://localhost:8000.This docker container will watch changes in the
docs/source
directory and rebuild the docs automatically -
Linux
First, please install the required dependencies
Then run the following commands to build the docs website
python3 -m pip install -U pip python3 -m pip install -r docs/requirements.txt cmake -H. -Bbuild -D DEPTHAI_BUILD_DOCS=ON -D DEPTHAI_PYTHON_BUILD_DOCS=ON cmake --build build --target sphinx python3 -m http.server --bind 0.0.0.0 8000 --directory build/docs/sphinx
Then open http://localhost:8000.
This will build documentation based on current sources, so if some new changes will be made, run this command in a new terminal window to update the website source
cmake --build build --target sphinx
Then refresh your page - it should load the updated website that was just built
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for depthai-2.3.0.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2143ee632eb9ffe9c6da8b21e244782bf7d17e0a483fbfda4f052e639a2da90 |
|
MD5 | 7b854a12e4d5f1773dd7dcd14a9f3f4c |
|
BLAKE2b-256 | 9dd45d3196bf00007e2ab26d7a3e0f1b862ad5ec362beda0940682f02598d088 |
Hashes for depthai-2.3.0.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2670086a8f9e8220f3476ca8ab37b447ee16b6f17c6bd702f6c44572dc96e987 |
|
MD5 | d19d5a16191b167bacc3fe552bac3194 |
|
BLAKE2b-256 | 17490a08218812abd6bdf09523c19ebe9d774d927d10837de016e62637b8d688 |
Hashes for depthai-2.3.0.0-cp39-cp39-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c3426419851a6ffea0780479ec8d1f373ed47a5938cb5b3c0069cfccb1b7d1c2 |
|
MD5 | 0aa947f96374bebe8c62e792cdc1b905 |
|
BLAKE2b-256 | 190cbf4b92bc815d289f85a1744c49e505c39539493933954e5adb5dae822e28 |
Hashes for depthai-2.3.0.0-cp39-cp39-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ccd6076ff2292f3bb55a439f08dd537a0fb359894877c76d838a941876a0799a |
|
MD5 | e9471f9aa81cbbfaeb176edc539327eb |
|
BLAKE2b-256 | c89371379b7e5510b1d91f3d701c58e071967708251a52c8521050f767fb703d |
Hashes for depthai-2.3.0.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d06b9193e27e5a9a425171cf79e331a56a22b3e3a2fdf68bf1b65d889b3d74a |
|
MD5 | 689a6e7b1c6637886e09796a9facc8dd |
|
BLAKE2b-256 | 3ae2e871338c9a2c0964cc2fb69f709573f7962b6ffad4a478fd0e7c4178ba33 |
Hashes for depthai-2.3.0.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 461c327b1a66fd4092b953eefab8c2b6881c63d7af8f7e9bc068693ca3187a9b |
|
MD5 | 0a7f902896e02eeee71b71e518055f8f |
|
BLAKE2b-256 | d787ff85690e1c71969b2cf0b9f950b48de59e9ce865d3fac24936297aca5f75 |
Hashes for depthai-2.3.0.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 174da09e8ac871698b717b589e79cbd6b7aafd7e7d8c354f5b548c25d27e9e8e |
|
MD5 | fc7c4e69c11d811545da5ac4f7644155 |
|
BLAKE2b-256 | 1fb2b978d2f9bd7c8ce59b5e113c1c2ef8e6bbfa3b424bc069ae250963647163 |
Hashes for depthai-2.3.0.0-cp38-cp38-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d5eb156a94cf855591db07b4d7ab2cdc5db08fed07982ea5f75ef5df4faf20b |
|
MD5 | a37e473ce2a096d892e4a9efaea9bc36 |
|
BLAKE2b-256 | 244e037ec71cabdd7149e7f7c3d71ac5a52540848f3847d7f30c1be092588188 |
Hashes for depthai-2.3.0.0-cp38-cp38-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fef19e1482908d33d800dc95a952d926c5e5f520c2cad1c2c3f5ef4d7526295d |
|
MD5 | 414273533378f1119bdcc9c38e96db08 |
|
BLAKE2b-256 | ed243bd32ce0cd1d7f5f253115ea8d1a2dcea361bc8a5eaef8aea614e047bfbc |
Hashes for depthai-2.3.0.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 968d7ac83083cefe6799b4454eae8a3a7fc564edb3bdef95fcacaf03a70d62ac |
|
MD5 | b01d12e56289f4fb8ac3f1fe403d4857 |
|
BLAKE2b-256 | e9b517ec3ce00b73f0675bc5367dfe118ac22c9feda51200df9ece2565f0f76b |
Hashes for depthai-2.3.0.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f31e34600aacec008730462038a2015126432ddef056af0d2778eada6c3fd2a7 |
|
MD5 | 1e3122d63ffb73c2a35d00a60bcba9ab |
|
BLAKE2b-256 | 0cde35a786d99526d9678e397e0ba3ef0f99d2df6e5e1850f9a7ba25bff2170f |
Hashes for depthai-2.3.0.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c50f468ab8ccfa44fc2249c84adc37627c23208227ec8e2a73625b931094702a |
|
MD5 | 28a5a7b198a0091cfcafb8945541c178 |
|
BLAKE2b-256 | 657ed9b253afd23d4317f07a10a00666f370126bc62654bb0fb071bda903dbe3 |
Hashes for depthai-2.3.0.0-cp37-cp37m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aff87a6922b4fbe57b33dabb2aeb07694202bc28538fbefeb01a3b0eefdd933 |
|
MD5 | e25e3a4d279bafdeddbad5abe1eb8fe9 |
|
BLAKE2b-256 | 3efa2ceb8b7071a0ebf69661a12b3bf406c72dbd5ff4d0ab3cc0f614eb927fab |
Hashes for depthai-2.3.0.0-cp37-cp37m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0121cc34e281745f13438e40a64762daa86474d03f4ea7491124da94a1d8ba19 |
|
MD5 | ffdc61a322542e4ac9fe68cc133e6643 |
|
BLAKE2b-256 | 2c842c4bcb9b8efe7e2d6299132d435f2c77f0cd4b714e43f9f0fc46ad906f42 |
Hashes for depthai-2.3.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7caea25ab61b78aba25ae1b02b5c26102036027d1c6f9063570d9409528a609 |
|
MD5 | 0ea51241847864cd521b93230a1712d7 |
|
BLAKE2b-256 | aecdb235420ead58e73554a20873106e7e1b23147cb93cbd545cce03690ed5be |
Hashes for depthai-2.3.0.0-cp37-cp37m-linux_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 30ba4e51e90ba11028aab3c9b0173a5aef2f2b6ea214f414e933f764617ef365 |
|
MD5 | 66fc2acb5e5bdabe76e10f45cd6160b6 |
|
BLAKE2b-256 | 79a0fd719fd4baa4177f45a822d07f5d19d865ddabb8960cbeae067658ed91b5 |
Hashes for depthai-2.3.0.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ba17720f561b2eb2f19f3f0f8a09b7e65eab15c94e04e512b3ee830db6a8856 |
|
MD5 | 13137cb04b508b1857cb866db3f8b2c0 |
|
BLAKE2b-256 | e4ac1e3fccc80bf491d758d0c044e1faec53213bb0f6f19c856489a8422e61f5 |
Hashes for depthai-2.3.0.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | adeb99d35d2280c01539f7e44e5cb08718e00711180370147cf6d5c88ac77d46 |
|
MD5 | e3e585611a862137d944c80eddc74da2 |
|
BLAKE2b-256 | 7649b58dcee54394a6adcc3dec62b273efa6372d6b0fd6f610d71f4e0ccc4b68 |
Hashes for depthai-2.3.0.0-cp36-cp36m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3034afb4c786910246a7c0aaa71d9c80da7fe70af5faa2f467daedefc0789013 |
|
MD5 | 4b34f5dcbdf99f8a9b778be73e6503cd |
|
BLAKE2b-256 | 460475ef681ab290a085e833acd810f7bd83bb697f61f1540a81b15d0e499bed |
Hashes for depthai-2.3.0.0-cp36-cp36m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 868b5e3e2cfa66e29629d0ceca434c548c9db11573dac7895dd21cc7961557e4 |
|
MD5 | ee726cbb4db5a30b16f359a2ae7c02c9 |
|
BLAKE2b-256 | 2631b3617f5335d567a3a03e78230672877d6db9a9c25a69caf82e8e67b2d301 |
Hashes for depthai-2.3.0.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3ffc93d678902404c56719656e6b3aaa7651a7958e60159a698f37cb548e8d8 |
|
MD5 | dd1c686cd4c8e3204e684ab20920e05d |
|
BLAKE2b-256 | e59cdd712815ef8c056d88e0f2737a9164a30fb62650addc465657350b3a4c58 |
Hashes for depthai-2.3.0.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4387b7d1697777a01981664c9beed503fd28a1a9e18674d1448e2a0b79e7fbad |
|
MD5 | f996d993cc9da92b713967d5955ae086 |
|
BLAKE2b-256 | 680b9a2bf201f89cc93bab548b6f651c4a1b2fbc18b8b29fdb734bb73634acf7 |
Hashes for depthai-2.3.0.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 998f879fae794709d8a593663a3d88858ef6194c168680d7d79a663815161880 |
|
MD5 | 0a1cf750e89e6320be075daea4127f41 |
|
BLAKE2b-256 | 11ef8ebb442e87601a800a075138cd989f8380a3410f112df6bca2ddf28c5f09 |
Hashes for depthai-2.3.0.0-cp35-cp35m-manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f89714bdb9603ec627e6f699760827ae7feb3e6e7c1817180aebfd5f7f2f0a76 |
|
MD5 | 7dacde256868dd5d5b1888d1b6861c1d |
|
BLAKE2b-256 | 9cef6794545836d3d05b0e1f88ac3636aa918f1af9b0ac4f565b5154bef5955a |
Hashes for depthai-2.3.0.0-cp35-cp35m-manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56d6a427f25f55ab9dee9bc5662ee4f8942ecd9920f52303b26005b2db830be2 |
|
MD5 | 9f25d0da53ec033d0d7785f564f60626 |
|
BLAKE2b-256 | 8e696d8cd559a221c8b357005815df2b5b20fc73e2924478745bf56a4d7f3370 |
Hashes for depthai-2.3.0.0-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 081c2663456fad0ae75a47b2f278b762a383d282ca69f899d253ddbc8777fd96 |
|
MD5 | 0cd9988634a1c31417d1668477f7dc51 |
|
BLAKE2b-256 | d3d26956e5f77e44321c0d26360359aa9e99102309471f057b703c2475a90973 |