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.5.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64dee6aa923611f9115b79e111b40cf02098132dfdcc5749b8262845ae58a700 |
|
MD5 | 758daba083072aaf4baf4804ffaf6e7c |
|
BLAKE2b-256 | c7316d77fddbbba5158ae39bde1197321575994843d5ea26a0ad6b2877ebb233 |
Hashes for depthai-2.5.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb55637a33677a5ab3d10727e6d390ad3c9ff84fb3ac0cb9f843eaa77faf5792 |
|
MD5 | 309816477db01aa1b5f8a4f74b624023 |
|
BLAKE2b-256 | 45b9d1cdfbdec7f00b84636a448f28b0a4dc8dc44406795fd42ffce071f9df97 |
Hashes for depthai-2.5.0.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51a67513c7f884f1d5a42b6fa96c429858d1dd0a52492bb391683ce4ae46be4b |
|
MD5 | d5b7b98ba421ac933f3010c1f450e3e6 |
|
BLAKE2b-256 | e3c1d604ff11152ce4ada266369b1c919f74ecc3e7bfa02afb8966dd0e916d13 |
Hashes for depthai-2.5.0.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 44544b2fd70edf8ab4bebe4921eed9dbe43dfc7992887600c946e1619821e39b |
|
MD5 | e536f503739bf9e1def0a10fb1c271a0 |
|
BLAKE2b-256 | fa43ecc844b5eafd66ef14e89829361ef822965f422631aed4c2b51cff4eb2f3 |
Hashes for depthai-2.5.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1695aaf7a2ea42e63a4e545aa13c3c8194a19a3229a1902fb8d71dcae86f14cc |
|
MD5 | 7357188960a7c318e8b3fd4e9068c749 |
|
BLAKE2b-256 | 53bc18a8b0057d18c3cbdf8e44ef013d16e68ecf4d55d1ba2abc6e9d2f96f706 |
Hashes for depthai-2.5.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0da0630accc81fb3293fce9eaa524eb00b87081146067ab2c9eca20ef5fb56e7 |
|
MD5 | 23a662403b093837394e6319b967ccc6 |
|
BLAKE2b-256 | 8a3575ab425022fdae0db464e7e569c7621e841380befffd16f280115aef53e2 |
Hashes for depthai-2.5.0.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b7d78cd21ffbde5781e080fdc69d82fa7a8832b00dc567b678fab9e810be2b98 |
|
MD5 | 61d9ce7c8406a0d610819aa7c1b4f3e2 |
|
BLAKE2b-256 | 675210819274c654f549f07bc609d66b11c0a95e28ddbd39926cbc5bc67235b6 |
Hashes for depthai-2.5.0.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8a0e0e12dfca7a52a3618ea332487787617c44fd2d27a582945f0e95cb9c7ea |
|
MD5 | 74ae08cf2ba751398590b9d5790d6675 |
|
BLAKE2b-256 | 66d1f89c83386380c8d5b563d0e2dee277215e0ed284b65e1ec6e8dc433c4b05 |
Hashes for depthai-2.5.0.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b3286f8cb118d8436f92a28a1f2d6d20578bf6408039c990a85b230577fbfe3 |
|
MD5 | ca364d8d3a3128fc2625306dddeee401 |
|
BLAKE2b-256 | bc3a80283bf7cc0fa4b289a84418c25d1f9508b53a7891acf4978b4496119977 |
Hashes for depthai-2.5.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d8b20f4fdd5f93cc5b5934476fcf83018704c69a8a5a9fd512811ac48e7136ba |
|
MD5 | 079d6c85455a29d47e40738dc60b1e7f |
|
BLAKE2b-256 | d8f3eb82230de418d27f629d60233a264c0bf950fad4a08abe2626ae38e55eea |
Hashes for depthai-2.5.0.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 749623ae9144461a7b3df0ffc87301b557941649d0f23121d026e2ce79fbcef8 |
|
MD5 | 768cfefbc0eb79024a3d07c91d94431f |
|
BLAKE2b-256 | 74d6d72af656428d57aeec690aac4489abec79812da7e0641b211a3b860fed91 |
Hashes for depthai-2.5.0.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2f245858c5d102229035fd8b8cccd70684cc2f751e4d5758185cf15df72643ca |
|
MD5 | 01ca3ed798c45c8b5cdd840fd7073c0c |
|
BLAKE2b-256 | d0ee92081a7fd866af5f087470cbe2f66d6778856f471a2d89f6360c9509297e |
Hashes for depthai-2.5.0.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b186daa4b2c258ac3f06a034a4232a9580cc174d8e828d907060a687a55ffea |
|
MD5 | e69ce3272e252cda5afc9a8ebd867ca9 |
|
BLAKE2b-256 | 1c5a83d2c2011740f3c3d18f61980b5bd0c865e3d07661bba19df4ab8a6fb99c |
Hashes for depthai-2.5.0.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d09740421cb7d2f48536912f00064271f5c67bdcbdbbd15023404de668fd439 |
|
MD5 | b539db132a30748eaaf7a55a51215a03 |
|
BLAKE2b-256 | 09143d545a9c8f0001232a24ac37ef29f192c16e9e871938d4bba0f2eceb043f |
Hashes for depthai-2.5.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bcbb53bab9e5ce502acbf568a795e3e0adfafc290cea4ae6c585a0dad9b68efc |
|
MD5 | 0e418166b5b873effe1b881edc65ce1f |
|
BLAKE2b-256 | 702a18c98fff63630f12a39403ddd47db785ee33217a7181cf4b9f72a000480d |
Hashes for depthai-2.5.0.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 04c142e3f21b022b8a15280eb003508023a939d49344ac4d03a8e411fc1685a2 |
|
MD5 | 3d0a7b48ebbf379f3dc055ac4524281b |
|
BLAKE2b-256 | 85b011c4d87f2baf43670e56b4742b36be9ea08e48984a47228e5fb349949bc1 |
Hashes for depthai-2.5.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93ecdf333df95c553891a11fb64650cc8c0295e3783e0234269875b80f011d9a |
|
MD5 | 07c0fa671599c2a14b1be85da366338d |
|
BLAKE2b-256 | 4eaf5cfcd9fecc87263b11f508dfb8bea4aac812b1565d2a0444db49ab60b01f |
Hashes for depthai-2.5.0.0-cp37-cp37m-linux_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2a81deb95596004cbcc1bb75ea7faf4924811492ef313f43a25e54e4aa16be8 |
|
MD5 | e9c68e97ae7f17ca06dd21b673454a11 |
|
BLAKE2b-256 | a7189a123667f8dd5719640ee06eb9e90d853aacdb76e1b7c783f0db8401ac5a |
Hashes for depthai-2.5.0.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b60ed5bcb63d562c7d6dc935af32bb52e39eaa8d0a69844541516ccbe12a3ad |
|
MD5 | a15c1a3cd778b16c67ad76ec54501498 |
|
BLAKE2b-256 | 95a3c45235ab1a0457983fd29d22e4f925254b12b0a5f88703ac76f6fa480e27 |
Hashes for depthai-2.5.0.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 911f26ea905686579d352ecd0c5559d6f64042df01919f879459d1ceb4affa56 |
|
MD5 | 53ba7fca164a93619836c4b004bf50cc |
|
BLAKE2b-256 | 25675626c0cdbd5bc9cdc7cb0206f1cdb295b4667b979164809e5ae7b8dafac2 |
Hashes for depthai-2.5.0.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdc36a49bb1d64e2be56b9b3cd351ab82a567bd69104d784c5465fb8557a5271 |
|
MD5 | f3889106491d2d9551e7687b5ca93f60 |
|
BLAKE2b-256 | eb924db675bfb65c81e24e5dd594c3b1312d976d97f81764f1409c55ae792ba7 |
Hashes for depthai-2.5.0.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0b7e8c16a9a0a6589309af3c7883c5468b4aac25371db20469a3ca6ccc4f3984 |
|
MD5 | 93e0c9bb65a597ffbe39f4a4ac22dcce |
|
BLAKE2b-256 | d8d3441c5c60ec856586418b4470a84b1278622586456837843743d88f30d8fe |
Hashes for depthai-2.5.0.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d8d3760e705377c060b796ad9959fa2884a687873a8ee0be0c968700f348b75 |
|
MD5 | 1a4a6d08622ad9b2b38d07f852a912e9 |
|
BLAKE2b-256 | 82839331d3d9077334b38a5f71d0ec3902a6d68926f864d371fff91855372b4f |
Hashes for depthai-2.5.0.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25136206fa89654fa2545fa4fed634bff87e45be61237c765e3c150444555587 |
|
MD5 | baa842a1a809fdf757ca0d08b123c3f7 |
|
BLAKE2b-256 | 046bcb18119a682cdf80bf1854dbdbfe24b4b68c43052d3f7835da1c29774caf |
Hashes for depthai-2.5.0.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a888f48a9e9a493d8c6d394a6bc50b1d4b77095c730289872eff73854d2e335 |
|
MD5 | 7a5744f4f7a5d55eea3ee20e54ea56d1 |
|
BLAKE2b-256 | f2a946f8f0e368ca68aa741c8260eadce23fe309e28eeba69b27118ffefeb0ad |
Hashes for depthai-2.5.0.0-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b8e069056d24e2e8a535e6c8a0d36cc83256662cb6d0dd918c26248b4ff769f2 |
|
MD5 | 180a25dec8d8502117879b1af1820c6a |
|
BLAKE2b-256 | 1f49289974484361621e8e215751152cf2ebed386af65696f6b423f8dd60cbce |