


First of all I’ll be using the package manager Homebrew to simplify things, you can get it here: *Here is the updated version of my previous post since Brew finally added the most recent version of OpenCV!ġ. Tf-estimator-nightly=2.8.0.**OpenCV is now at 3.0.0! :), I will write up a guide on that when I get around to installing it You should have the conda Miniforge 3 installed : # This file may be used to create an environment using: I leave below the requirements in case you might want to recreate the environment that worked in my case. I finally managed to do so but to be honest not really sure how and why.
#Setting up opencv for mac install#
In my case I also had lot of trouble trying to install both modules. So all the other dependencies seems fine (for now) besides either OpenCV not working or if it is working with conda install then it seems that scipy and scikit-learn don't work. Ultimately I want to use Tenserflow Model Zoo Object Detection models. So any help would be highly appreciated if I can make any of the ways work. Not sure if that is affecting it but seems like it didn't do anything because still uses /opt/homebrew/ instead of /usr/local/.

One of the guides said to install homebrew also in arm64 env, so I did it with: /bin/bash -c "$(curl -fsSL )"Įxport PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"Īlias ibrew='arch -x86_64 /usr/local/bin/brew' # create brew for intel (ibrew) and arm/ silicon Ln: /opt/homebrew/opt/ffmpeg/lib/libavcodec.58.dylib: No such file or directory (silicon) MacBook-Pro:opencv-4.5.0 adi$ ln -s /usr/local/Cellar/ffmpeg/4.4_2/lib/libavcodec.58.dylib /opt/homebrew/opt/ffmpeg/lib/libavcodec.58.dylib usr//local/Cellar/ffmpeg/4.4_2/lib/libavcodec.58.dylib Though I have these libs, so when I searched with: find /usr/ -name 'libavcodec.58.dylib' I could find many locations: find: /usr//sbin/authserver: Permission deniedįind: /usr//local/mysql-8.0.22-macos10.15-x86_64/keyring: Permission deniedįind: /usr//local/mysql-8.0.22-macos10.15-x86_64/data: Permission deniedįind: /usr//local/hw_mp_userdata/Internet_Manager/OnlineUpdate: Permission denied Referenced from: /Users/adi/miniforge3/envs/silicon/lib/python3.8/site-packages/cv2/ ImportError: dlopen(/Users/adi/miniforge3/envs/silicon/lib/python3.8/site-packages/cv2/, 2): Library not loaded: /opt/homebrew/opt/ffmpeg/lib/libavcodec.58.dylib So it complained: Traceback (most recent call last):įile "/Users/adi/miniforge3/envs/silicon/lib/python3.8/site-packages/cv2/_init_.py", line 5, in It seems like it searches for the ffmepg via homebrew (I didn't install any of these via homebrew but with conda). The other way I try to install openCV is with conda: conda install opencvīut then when I test with python -c "import cv2 cv2._version_" Or also like in another tries was initially asking for calib3d or dnn but those libraries are there in the main folder opencv-4.5.0. So it cries like: Linking CXX shared library. Then I created a folder " build" in my opencv-4.5.0 folder and the cmake command I use in it is (my miniforge conda environment is called silicon and made sure I am using arch arm64 in bash environment): cmake -DCMAKE_SYSTEM_PROCESSOR=arm64 -DCMAKE_OSX_ARCHITECTURES=arm64 -DWITH_OPENJPEG=OFF -DWITH_IPP=OFF -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=/Users/adi/miniforge3/opencv_contrib-4.5.0/modules -D PYTHON3_EXECUTABLE=/Users/adi/miniforge3/envs/silicon/bin/python3.8 -D BUILD_opencv_python2=OFF -D BUILD_opencv_python3=ON -D INSTALL_PYTHON_EXAMPLES=ON -D INSTALL_C_EXAMPLES=OFF -D OPENCV_ENABLE_NONFREE=ON -D BUILD_EXAMPLES=ON /Users/adi/miniforge3/opencv-4.5.0 I git cloned and unzipped the opencv-4.5.0 and opencv_contrib-4.5.0 in my miniforge3 directory. So I am not sure what to do in order to make successfully the file. It fails at different stages, crying for different libraries, despite they are there but max reached 31% after multiple cmake and deletion of the build folder or the cmake cash file. I tried to compile it from source but seems like it can't find the modules from its core package so constantly can't make the file after the successful cmake build. I managed to figure out most of the errors after more than 2 weeks.

#Setting up opencv for mac mac#
I think I read pretty much most of the guides on setting up tensorflow, tensorflow-hub, object detection on Mac M1 on BigSur v11.6.
