From 4558766504c554e58c474b01ea8bcc8c6bfbf680 Mon Sep 17 00:00:00 2001 From: Erol444 Date: Fri, 4 Mar 2022 10:50:16 +0100 Subject: [PATCH 1/2] Added tutorial on how to build native M1 wheels for depthai-python --- docs/source/install.rst | 50 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index fa46a4a18..9c11da647 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -46,7 +46,9 @@ macOS Close and re-open the terminal window after this command. -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 `__ for some additional troubleshooting steps. +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 `__ +for some additional troubleshooting steps. Note that if the video streaming window does not appear consider running the following: @@ -57,6 +59,52 @@ following: See the `Video preview window fails to appear on macOS `_ thread on our forum for more information. +M1 Mac build wheels natively +---------------------------- + +In order to run DepthAI natively on M1 Mac, you currently need to build the wheels locally. We will add pre-building M1 wheels +in Q2 of 2022, so this won't be needed anymore. + +This tutorial was provided by whab and tested on a MacBookPro M1 Pro running macOS Monterey 12.1 with a OAK-D-Lite. + +.. code-block:: bash + + # Install native M1 version of brew + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" + echo 'eval "$(/opt/homebrew/bin/brew shellenv)"' >> ~/.zprofile + eval "$(/opt/homebrew/bin/brew shellenv)" + + # Install conda to create virtual environments for Python + brew install --cask miniconda + conda init zsh + + # Close and re-open a Terminal window + + # Install DepthAI by building a M1 wheel (inside ~/DepthAI/) + conda create --name DepthAIEnv39 python=3.9 + conda activate DepthAIEnv39 + python3 -m pip install -U pip + brew update + brew install cmake libusb + cd ~; mkdir DepthAI; cd DepthAI + git clone --recursive https://github.com/luxonis/depthai-python.git + cd depthai-python + mkdir build && cd build + # Build deptha-python + cmake .. + cmake --build . --parallel + cd .. + python3 -m pip wheel . -w wheelhouse + pip install wheelhouse/depthai-* + + # Test DepthAI with a OAK plugged to your new M1 Mac + cd examples + nano install_requirements.py + # Remove code of block (3 lines) starting with: if thisPlatform == "arm64" and platform.system() == "Darwin": + # Remove code of block (48 lines) starting with: if not args.skip_depthai: + python3 install_requirements.py + python3 ColorCamera/rgb_preview.py + Ubuntu ****** From ea866a380a81609aa647049ec541ae96fda19957 Mon Sep 17 00:00:00 2001 From: Erik Date: Tue, 8 Mar 2022 13:27:40 +0100 Subject: [PATCH 2/2] Update docs/source/install.rst --- docs/source/install.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/install.rst b/docs/source/install.rst index 9c11da647..b7cae8560 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -90,7 +90,7 @@ This tutorial was provided by whab and tested on a MacBookPro M1 Pro running mac git clone --recursive https://github.com/luxonis/depthai-python.git cd depthai-python mkdir build && cd build - # Build deptha-python + # Build depthai-python cmake .. cmake --build . --parallel cd ..