-
Notifications
You must be signed in to change notification settings - Fork 231
-
Notifications
You must be signed in to change notification settings - Fork 231
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Installation issue when using M1 Chip #299
Comments
Hi @esbasti , I have not seen this. But I do have something that might be helpful. Here is what we did to get development working on M1 Macs: The why is that some development tools don't yet run natively on M1 Macs. Thoughts? Thanks, |
Thank you @Luxonis-Brandon for getting back to me. I tried running the terminal under Rosetta. But, unfortunately I'm still getting the same error. |
Got it. Just to make sure I'm on the same page, have you already run the following (from here)? If you haven't please do close and re-open the terminal after doing so, and run python3 -m pip install -U pip, which should show something like: And I want to share this video in case it's helpful in getting up/going: Unfortunately I don't have an M1 Mac on hand (I really want to get one) to try out, otherwise I could see about reproducing. @alex-luxonis does have one. |
Thanks for the video, it was very helpful I was skipping the Notheless I get a new error when running this command. I think this time the error is caused by home brew. I tried to run homebrew under rosetta 2. But, still got the same error `Collecting depthai During handling of the above exception, another exception occurred: Traceback (most recent call last):
|
I saw that one once as well. Can you close the terminal, re-open, and run |
Oh, and sorry. cmake wasn't installed somehow. Can you do |
Hi @esbasti, This doesn't seem good:
It tries to build the wheel from sources ( Could you open a terminal under Rosetta and confirm that the command
I'm getting this output on Apple M1 with python 3.9.1.5:
|
Hi @alex-luxonis thanks for looking into this as well I can confirm you that after running the command Notheless, when i run WARNING: Skipping depthai as it is not installed. And when run Here is the error log Collecting depthai During handling of the above exception, another exception occurred: Traceback (most recent call last):
|
@esbasti Thanks for trying out the commands. So after I installed Homebrew and then the other packages (python3, etc) under Rosetta, later on even when running in a native I'm reinstalling macOS now, and trying to see if I could get to reproduce your situation, where the build from sources is always attempted. This will take some time... Just in case, if you haven't already, could you try closing and reopening terminal consoles and maybe also rebooting. Sometimes changes done by installed programs (altering PATH or other environment variables) don't take effect otherwise. If still no improvement, could you try the command that Brandon suggested |
@esbasti So I erased and reinstalled Big Sur on my Mac M1, then did these:
Next I cloned this repo, ran I highlighted in bold the steps from above that I believe helped. Let us know how it goes on your side. |
Still not luck. Tried the steps above And after running the command Also thought it may had to do something with how I installed Brew and Rosetta and try this: But it still fails Collecting depthai CMake Error: Could not open file for write in copy operation /Users/sebastianvillalobos/.hunter/_Base/062a19a/5e27f7a/2a6efb3/Build/XLink/Build/XLink-Release-prefix/src/XLink-Release-stamp/download-XLink-Release.cmake.tmp CMake Error at /opt/homebrew/Cellar/cmake/3.19.2/share/cmake/Modules/ExternalProject.cmake:2726 (file):
Call Stack (most recent call first): CMake Error at /opt/homebrew/Cellar/cmake/3.19.2/share/cmake/Modules/ExternalProject.cmake:1492 (file):
Call Stack (most recent call first): CMake Error: Could not open file for write in copy operation /Users/sebastianvillalobos/.hunter/_Base/062a19a/5e27f7a/2a6efb3/Build/XLink/Build/XLink-Release-prefix/tmp/XLink-Release-cfgcmd.txt.tmp -- Configuring incomplete, errors occurred! [hunter ** FATAL ERROR **] Configure step failed (dir: /Users/sebastianvillalobos/.hunter/_Base/062a19a/5e27f7a/2a6efb3/Build/XLink) ------------------------------ ERROR -----------------------------
|
@esbasti I was able to build the I also see from your logs above that the build was progressing, but reaching some permission issues in But anyway, this isn't the right direction for fixing the problem (at least for now), as some python libraries are still not supported under native Apple M1. Most prominent is To check directly under which platform
In your case it must be something with the Homebrew install. Could you check the PATH env var And if the problem persists, maybe even remove completely Homebrew, running in a native terminal:
And then reinstall with this command under Rosetta: |
Finally I was able to install all dependencies successfully and run the demo. What ended up working was what @alex-luxonis suggested. Which was: And if the problem persists, maybe even remove completely Homebrew, running in a native terminal:
And then reinstall with this command under Rosetta: In addition to running this commands I had to manually delete the Homebrew directory in both locations. Thank you both for taking the time and troubleshoot for a solution @Luxonis-Brandon @alex-luxonis |
Glad it's working and thanks for circling back! |
Thanks! Closing as resolved. We also updated the install script for macOS, it can be run now on M1 without having to run the terminal under Rosetta (it will automatically prefix certain commands with |
The DepthAI API and examples (gen2_develop branch) run fine natively on M1 by the way, once you get native OpenCV for Python installed (I built it from source weeks ago, but it should be possible to install it now using conda via conda-forge) as well as Numpy (also using conda-forge). |
We were thinking to recommend users to run under Rosetta, until opencv-python, numpy, etc. get to a stable state on M1 arm64, or at least could be built from sources with |
I have been using M1-native only development tools since day 1 (early December) and so far Homebrew and Conda-forge have provided all the packages I needed, and in the worse cases building from sources has not been an issue at all. |
Thanks, both. And good to know @whabilly . The M1 chips are so impressive. Cool to see computer innovation like this. Before the M1, it seemed computer processors weren't -really- getting any faster in terms of daily user experience. |
Wondering what the status of this is one year later. I just got my OAK-D lite today and wondering if I can install all native arm libraries and binaries or if I need to compile any dependencies. |
Man how time flies! Native M1 actually is largely dependent on external tools being converted to M1. And I'm not sure if those are ported just yet. Would have to check. Checking... That said, install on M1 Mac (M1, M1 Pro, M1 Max) is clean using Rosetta. So no dependencies are required. Will circle back shortly. |
Especially the last couple of years! 2020 and 2021 just blend together for me.
I would like to avoid having an Intel (Rosetta) Homebrew install on this machine, hence the question. Now that OAK-D Lite is out maybe more M1 Mac users will come together to find a more seamless solution.
Thanks! |
I don’t know why Luxonis does not provide native support for M1 yet, but I have been able to use DepthAI natively on M1 for a full year since I got a Mac mini M1 and a OAK-D. You just need to build and install your own DepthAI wheel. Here are step-by-step instructions to build, install and test a M1 native version of DepthAI in less than 30 minutes (tested on a new MacBookPro M1 Pro running macOS Monterey 12.1 with a OAK-D-Lite): Install native M1 version of brew/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)" Install conda to create virtual environments for Pythonbrew install --cask miniconda Install DepthAI by building a M1 wheel (inside ~/DepthAI/)conda create --name DepthAIEnv39 python=3.9 Test DepthAI with a OAK plugged to your new M1 Maccd examples Enjoy! |
Thank you! We can likely integrate this to provide pre-built libraries for Apple M* processors. Asking team. |
Hi @whab The reason for not yet having M1 prebuilt wheels is mostly due to GitHub Actions not yet offering M1 macs a Runners. One option is also custom runners... will circle back if/when we decide to pick any of these options |
Worked like a charm on a MBP M1 Max! Thank you for the detailed write up. I did get a bunch of warnings at the end of BTW, instead of using conda I created the virtual environment like this instead:
@Luxonis-Brandon , @themarpe I know that ideally you'd like to provide pre-built libraries for M1, but it would be great to have this process added to the docs In the meantime. Hopefully this issue will be discoverable as well. Thanks @whab ! |
Thanks for giving this a try on your end as well @ikester
@ikester would you be able to test this? If it works as expected, we'll add it to the docs. |
@themarpe that didn't work for me. I ran the
|
@whab, so the examples in the
|
@ikester
Also, can you run the following snippet on your M1 machine and post back the results:
|
Here are additional step-by-step instructions for running the GUI demo from depthai-3.0.9 (downloaded from https://github.com/luxonis/depthai/releases) on M1 Macs. They need to be applied after the previously provided instructions and in the same virtual environment DepthAIEnv39: cd depthai-3.0.9 Edit requirements.txt and keep only the lines specified below (note that opencv-contrib-python==4.5.5.62 was replaced with opencv-contrib-python==4.5.5.62):nano requirements.txt Edit install_requirements.py:nano install_requirements.py Edit depthai_sdk/requirements.txt and keep only the lines specified below:nano depthai_sdk/requirements.txt Install dependenciesconda install -c anaconda pyqt Run the GUI demo (the UVC mode, aka Webcam, under the Misc tab also works!)python3 depthai_demo.py To check the architecture of the compiled module (arm64 should be reported for native M1 code):lipo -info /opt/homebrew/Caskroom/miniconda/base/envs/DepthAIEnv39/lib/python3.9/site-packages/depthai.cpython-39-darwin.so Tested on a new MacBookPro M1 Pro running macOS Monterey 12.1 with a OAK-D-Lite. Enjoy! |
After adjusting the command so it can run (replaced
I get: |
Thanks @whab. This worked for me, using my self-built wheel. Not ideal given all the steps and how error-prone this is. Really looking forward to a streamlined M1 experience. |
Just for reference: luxonis/depthai-python#604 Checking out that branch and running: We are in progress of also making a release with m1 wheels included, but are still resolving some intermitten issues with the builders. Thanks for all the discussion on pre-official support for m1! |
Thanks for all the people putting effort into this. Trying @whab's recipe from #299 (comment), it was all going very well until I got to the
Granted that I don't know what I'm doing... any suggestions? TIA. |
Official M1 wheels are available since: #299 (comment) Please follow that installtion. If you are still hitting issues - double check your installation of python3, to see if its arm64 arch or x86 |
Hi,
Has anyone experienced issues when trying to run
python3 install_requirements.py
in Big Sur OS.Seems like the problem is related to the numpy library. However, I was able to install numpy through home brew and did not get the same error.
Happened on Big Sur running on a M1 chip
Here is the error log:
Requirement already satisfied: pip in /opt/homebrew/lib/python3.9/site-packages (20.3.3)
WARNING: Skipping depthai as it is not installed.
Ignoring open3d: markers 'platform_machine != "armv7l" and python_version < "3.9"' don't match your environment
Collecting argcomplete==1.12.1
Using cached argcomplete-1.12.1-py2.py3-none-any.whl (38 kB)
Collecting depthai==0.4.0.0
Using cached depthai-0.4.0.0.tar.gz (84 kB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... done
Collecting numpy==1.19.3
Using cached numpy-1.19.3.zip (7.3 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /opt/homebrew/opt/python@3.9/bin/python3.9 /opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/45/h1sx4z4164v9hqc36ryjvvfm0000gn/T/tmp60t7dj_s
cwd: /private/var/folders/45/h1sx4z4164v9hqc36ryjvvfm0000gn/T/pip-install-tomzolhy/numpy_92985193da7a427c82dd73d9d6d03651
Complete output (217 lines):
Running from numpy source directory.
setup.py:480: UserWarning: Unrecognized setuptools command, proceeding with generating Cython sources and expanding templates
run_build = parse_setuppy_commands()
Processing numpy/random/_bounded_integers.pxd.in
Processing numpy/random/_philox.pyx
Processing numpy/random/_bounded_integers.pyx.in
Processing numpy/random/_sfc64.pyx
Processing numpy/random/_mt19937.pyx
Processing numpy/random/bit_generator.pyx
Processing numpy/random/mtrand.pyx
Processing numpy/random/_generator.pyx
Processing numpy/random/_pcg64.pyx
Processing numpy/random/_common.pyx
Cythonizing sources
blas_opt_info:
blas_mkl_info:
customize UnixCCompiler
libraries mkl_rt not found in ['/opt/homebrew/Cellar/python@3.9/3.9.1_5/Frameworks/Python.framework/Versions/3.9/lib', '/usr/local/lib', '/usr/lib', '/opt/local/lib']
NOT AVAILABLE
ERROR: Command errored out with exit status 1: /opt/homebrew/opt/python@3.9/bin/python3.9 /opt/homebrew/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py prepare_metadata_for_build_wheel /var/folders/45/h1sx4z4164v9hqc36ryjvvfm0000gn/T/tmp60t7dj_s Check the logs for full command output.
Traceback (most recent call last):
File "/Users/sebastianvillalobos/Sabana Tech/smartaccess/depthai/install_requirements.py", line 17, in
subprocess.check_call([*pip_install, "-r", "requirements.txt"])
File "/opt/homebrew/Cellar/python@3.9/3.9.1_5/Frameworks/Python.framework/Versions/3.9/lib/python3.9/subprocess.py", line 373, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['/opt/homebrew/opt/python@3.9/bin/python3.9', '-m', 'pip', 'install', '--user', '-r', 'requirements.txt']' returned non-zero exit status 1.
The text was updated successfully, but these errors were encountered: