Skip to content

Commit 3a6e007

Browse files
authored
Added tutorial on how to build native M1 wheels for depthai-python (#526)
* Added tutorial on how to build native M1 wheels for depthai-python * Update docs/source/install.rst
1 parent f95e73e commit 3a6e007

File tree

1 file changed

+49
-1
lines changed

1 file changed

+49
-1
lines changed

docs/source/install.rst

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,9 @@ macOS
4646
4747
Close and re-open the terminal window after this command.
4848

49-
The script also works on M1 Macs, Homebrew being installed under Rosetta 2, as some Python packages are still missing native M1 support. In case you already have Homebrew installed natively and things don't work, see `here <https://github.com/luxonis/depthai/issues/299#issuecomment-757110966>`__ for some additional troubleshooting steps.
49+
The script also works on M1 Macs, Homebrew being installed under Rosetta 2, as some Python packages are still missing native M1
50+
support. In case you already have Homebrew installed natively and things don't work, see `here <https://github.com/luxonis/depthai/issues/299#issuecomment-757110966>`__
51+
for some additional troubleshooting steps.
5052

5153
Note that if the video streaming window does not appear consider running the
5254
following:
@@ -57,6 +59,52 @@ following:
5759
5860
See the `Video preview window fails to appear on macOS <https://discuss.luxonis.com/d/95-video-preview-window-fails-to-appear-on-macos>`_ thread on our forum for more information.
5961

62+
M1 Mac build wheels natively
63+
----------------------------
64+
65+
In order to run DepthAI natively on M1 Mac, you currently need to build the wheels locally. We will add pre-building M1 wheels
66+
in Q2 of 2022, so this won't be needed anymore.
67+
68+
This tutorial was provided by whab and tested on a MacBookPro M1 Pro running macOS Monterey 12.1 with a OAK-D-Lite.
69+
70+
.. code-block:: bash
71+
72+
# Install native M1 version of brew
73+
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
74+
echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile
75+
eval "$(/opt/homebrew/bin/brew shellenv)"
76+
77+
# Install conda to create virtual environments for Python
78+
brew install --cask miniconda
79+
conda init zsh
80+
81+
# Close and re-open a Terminal window
82+
83+
# Install DepthAI by building a M1 wheel (inside ~/DepthAI/)
84+
conda create --name DepthAIEnv39 python=3.9
85+
conda activate DepthAIEnv39
86+
python3 -m pip install -U pip
87+
brew update
88+
brew install cmake libusb
89+
cd ~; mkdir DepthAI; cd DepthAI
90+
git clone --recursive https://github.com/luxonis/depthai-python.git
91+
cd depthai-python
92+
mkdir build && cd build
93+
# Build depthai-python
94+
cmake ..
95+
cmake --build . --parallel
96+
cd ..
97+
python3 -m pip wheel . -w wheelhouse
98+
pip install wheelhouse/depthai-*
99+
100+
# Test DepthAI with a OAK plugged to your new M1 Mac
101+
cd examples
102+
nano install_requirements.py
103+
# Remove code of block (3 lines) starting with: if thisPlatform == "arm64" and platform.system() == "Darwin":
104+
# Remove code of block (48 lines) starting with: if not args.skip_depthai:
105+
python3 install_requirements.py
106+
python3 ColorCamera/rgb_preview.py
107+
60108
Ubuntu
61109
******
62110

0 commit comments

Comments
 (0)