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.4.0.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd20c9ec132a2e69349478c9187aaef056c09c0ed7686fc2c8fb9b2e9f3025ce |
|
MD5 | bd5ed372a40b3f780edbddef1c78381c |
|
BLAKE2b-256 | 4a0da0cbd36fd4925032807089cab1fd297539c8fa969b085431e867921fcb61 |
Hashes for depthai-2.4.0.0-cp310-cp310-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c238b6ed6f68a725de0a97083e568b5b3460eb7a54195d0ee303d4793a8151c2 |
|
MD5 | b00f8661a744e463b9c861c44b55993b |
|
BLAKE2b-256 | 960e34d3ea1e5f547c64b53063f33e5e1b76e5593a41447592b0c2852956f131 |
Hashes for depthai-2.4.0.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0624123aaa8db92592383b1941fce9686bbc01ca52db54bc1f45f0c6ac7a80c5 |
|
MD5 | 226dcebc7848e9e9a9a2a83722cfe110 |
|
BLAKE2b-256 | 09a7e8af9b45008d4eb1b6278e7484156f1cf58a4d49d7b5d200dbfd58982620 |
Hashes for depthai-2.4.0.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43bcf343a5dad5694d12b876bd3234d65fc5ae1fc4df9f0febab48646edb11a8 |
|
MD5 | c97786fa83d331810a1983169e5045f3 |
|
BLAKE2b-256 | 7bd8ecaaeca6cb625de051f8d8a1082d5f8428089694e4e94596b32aa34df857 |
Hashes for depthai-2.4.0.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 38cb8f0fdb7feb7928067a18ca8b0331753f1942b8fc8cf6a9f19b5741082fb0 |
|
MD5 | c07d38a9f311863cdf120279c455dd58 |
|
BLAKE2b-256 | 2725153d45f5c184f4e44e2babac3fd6f7668ddb9f0c29d5d2faba213c0fc4da |
Hashes for depthai-2.4.0.0-cp39-cp39-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff608d879c07d7f33218eacea2aecb7166d617cf4f1b8525bdd2e1f9b655a825 |
|
MD5 | 6a9d9f31a49c0e3b055809f508fb4be1 |
|
BLAKE2b-256 | 2c3908db79ec9b0bf502b0a23191b79ea28ae0114ebb6ca5ba24c20858d1f5fd |
Hashes for depthai-2.4.0.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d72b885c2c4266c8306f4ee11db5bae9aece3ac8afb9e04129f412e5d59f9ae |
|
MD5 | 247e3b24b430106cceb2e7f6bb335c2b |
|
BLAKE2b-256 | 7c1d1b8dae4026818fc2b3e224e9e8141617020821918150afcd72ceb68b5bbb |
Hashes for depthai-2.4.0.0-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9973bea176ed43c1ef2a22b94fde8943a505543ecaaebe027cedcd52e68d6371 |
|
MD5 | 31a3415d8391901c4534f762fe055357 |
|
BLAKE2b-256 | 688a731f41cf62bcc33cc4f6e6a5c8fc7e4022a28e04b8b191f4ab603cb8bf40 |
Hashes for depthai-2.4.0.0-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09b37e9d6d845e787a5baf8002cb619a6f28543c650048e873c0ac2bd45664a4 |
|
MD5 | 5d035b32af8c414a3c0950f8e2119719 |
|
BLAKE2b-256 | 47a7fbf7c1106acfe5a055e637bbe4abca4d527d33aea18025fd696f3abb30f7 |
Hashes for depthai-2.4.0.0-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50ab4efaacbb3e5ecd293c003d5fe643eae9b8916431043a79b3a3c2385f4b3e |
|
MD5 | a18cc17d8bd62368d7acc5eb4fe74a91 |
|
BLAKE2b-256 | 0d20733b1dab7b88fb6e838a9635f00fd55049167306ec3d92d5de7f5c5b955e |
Hashes for depthai-2.4.0.0-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f4532c97d51ff1afdc4734e55da78741134d15148549bda818fdee2439656ef5 |
|
MD5 | bd615ba713a518d5fec7973238e853fe |
|
BLAKE2b-256 | 05d79e212c8d9ae523493671189ce2cb468f4be5da6804e66a3fed0540bf318d |
Hashes for depthai-2.4.0.0-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d2d2cc5ceb83003a3f194ed56a74f352398e53c28149e3e10c6adc9e1d056eab |
|
MD5 | 2b242072176d96714ddff67a569ffc74 |
|
BLAKE2b-256 | 6dbbac1eec1ac367a77049c105159e165d21367de7833ef7a8267158e31db96c |
Hashes for depthai-2.4.0.0-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 742ee1ba956be1e0c930dddf47ef226b660721a0c76f338a498a4b60e3f6429c |
|
MD5 | a5ff4b3c8554fcafb04b013d815e3dfa |
|
BLAKE2b-256 | a4fb1426f26686997d5d725a93cbaf23138d1f2a0f6f04080cb1a058b63a9537 |
Hashes for depthai-2.4.0.0-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5fcc2ae34b9f67def25541e1fc3b8938aafdab6814811b8386965076836374b1 |
|
MD5 | fda38a66ccdbafb97c1d2d2396308fb3 |
|
BLAKE2b-256 | db6770fddb529c38eeb6ecdc97319557be6017887579e759d1aff7ed4f99ad30 |
Hashes for depthai-2.4.0.0-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8090ec45d9ee0df2c2871d3865203c5ea002630007d0699b30b0186cef1776ae |
|
MD5 | 810adbb4f4a4c29cd3404ffa064770aa |
|
BLAKE2b-256 | d3ab1f54765286de3f42bf95854ca487d461842292642da7554877b380e10c8a |
Hashes for depthai-2.4.0.0-cp37-cp37m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f4089dbbdcd88f722241bfd76fc627e6b1c33b0e272139c38853805bf77ae94 |
|
MD5 | 6faf882a295bcc014339f5abce3a3414 |
|
BLAKE2b-256 | 485754a2fe973d1147f29f0a2e220ae975172f81d98610ee05ea81c98f3d965d |
Hashes for depthai-2.4.0.0-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 81f4b6142e7b9dbf90f4f648683d1e609a15db5d84bf7e11523223ff753df962 |
|
MD5 | 50dac39fdcc7ee7d20856de3c71eed68 |
|
BLAKE2b-256 | a302a3ca5b03061965f258a586704c22f57521e3cf0d8e3756145a8b2d9375ee |
Hashes for depthai-2.4.0.0-cp37-cp37m-linux_armv7l.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 07c8f673d282b15c12abcfeac78fac67f7145606f7ed84c4977ec7ad6acc4c5e |
|
MD5 | 134e90c9839ee0c7998a061914103caa |
|
BLAKE2b-256 | 661f605521db3aa30b6be23126dd5575c32bcf9a864eb948a2999f838a325c4d |
Hashes for depthai-2.4.0.0-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1f9eb8f5a6d553c89febe19928bd388f57562540b704eea584dc877fa1267d26 |
|
MD5 | b545cdba6ff172b15aacf840b2431aa6 |
|
BLAKE2b-256 | 5d80cb347fe400c7c98653655843547fffc8ab81c37f886396e3bffca6cdc101 |
Hashes for depthai-2.4.0.0-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 87800d35f972e63eea60d4b81abdf9038ffa0e0143993bfdc2ee885c0bc16b5f |
|
MD5 | c3757f5e7fa226c9ea65382599221d85 |
|
BLAKE2b-256 | b1f95bd5958bf30e18e341619a342d543caa86637b19a0f4a18ebca58412e2ed |
Hashes for depthai-2.4.0.0-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5667c10f1165de8b18348d6b6d04470df6f9e6a6d50d400f4f7b04e083e130a0 |
|
MD5 | ed9a042afa7d4a88e3355a80e0ad5edf |
|
BLAKE2b-256 | fc6d4d87b74fd6ecdf391ab4451f89b71cd17c9fbcf53a0a8cc882678c94b646 |
Hashes for depthai-2.4.0.0-cp36-cp36m-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb95a487e88a169490e2568c3e3b84956f68baaeaa0e6e69b3a69ec93d57be4b |
|
MD5 | 321a3aeaf70248f04ca5150e143f26de |
|
BLAKE2b-256 | 6e030df5bb9c4ab79b3177a810ee4c855a8600a53c08e67faa0f9d5cc435a3d7 |
Hashes for depthai-2.4.0.0-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a8fe52973d36bae05534afb1cee26ed9120d60df6b30ed8a3461f30863b09627 |
|
MD5 | d43c74823678ebe5c9690286b7587b6b |
|
BLAKE2b-256 | 1741f7c4547581d77f258b1da5330192b57896fa73d16f080b3a1c180e54c148 |
Hashes for depthai-2.4.0.0-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f7b28d4612356ae486ed22a7ff97c3c700f5ca5f780ed46ad153081f09d1c00 |
|
MD5 | 9e80bed488af582eed41f9a456a7f1a7 |
|
BLAKE2b-256 | 708a903e4fdb06abc85ad917ce66ba449e1d083d33fc205183a342de18e0c38a |
Hashes for depthai-2.4.0.0-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0d1eb1e995e26a0e17f1f4ae63a66e1bce10363047a5dd47542ef0b5d649549c |
|
MD5 | 5147b2721dc7273b8bf529cab534dd30 |
|
BLAKE2b-256 | 3c547f2b9f447e50dee0a175fcb7ac5d1263823f062ceaca8f748485359d8449 |
Hashes for depthai-2.4.0.0-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e2c9302c333a30cf82ffd31b9e796bef4b532519589d24e904d7864346d992dd |
|
MD5 | 3145b6a23a78043ea7d5290b00a175c0 |
|
BLAKE2b-256 | a98591cb565815f3663c5be1ec78836080a7235ba34c39b3fb83b500da304b6f |