seanwang
seanwang

Reputation: 21

opencv-python compiled fail in apple m1 chip

I installed Tensorflow-macos and try to install opencv-python but always fail in this message

ERROR: Command errored out with exit status 1: /Users/sean/Documents/sysvenv/tf24v/bin/python3 /Users/sean/Documents/sysvenv/tf24v/lib/python3.8/site-packages/pip install --ignore-installed --no-user --prefix /private/var/folders/gy/jzs3xnwd1z3203d75y_31nxc0000gn/T/pip-build-env-en64krht/overlay --no-warn-script-location -v --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools wheel scikit-build cmake pip 'numpy==1.13.3; python_version=='"'"'3.6'"'"'' 'numpy==1.14.5; python_version=='"'"'3.7'"'"'' 'numpy==1.17.3; python_version=='"'"'3.8'"'"'' 'numpy==1.19.3; python_version>='"'"'3.9'"'"'' Check the logs for full command output.

it lookalike the bumpy version problem. But In Tensorflow-macos it it 1.8.5 and python is 3.8 Does anynoe have the same problem? thanks

Upvotes: 2

Views: 5280

Answers (2)

Rustam-Z
Rustam-Z

Reputation: 113

after searching the web I have successfully installed OpenCV on my Mac M1.

  1. Probably you don't have brew installed, so here's how you should install it:
    • /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
    • brew install wget
    • brew install miniforge
    • brew install cmake, you will need cmake for building OpenCV code
  2. Then just follow this blog: https://sayak.dev/install-opencv-m1/#Install-conda

P.S. If mdfind cv2.cpython returning an empty string then try to delete the build folder and compile opencv again. Otherwise, you have done everything correctly.

Upvotes: 1

user1677899
user1677899

Reputation: 91

You might want to look at these suggestions:

I was successful in installing Python 3.9.1 for Apple Silicon and then running conda install opencv. However, the slow time to compute a few functions for the first time might suggest some components are still being translated via Rosetta. Regardless, while I did not test performance the functions I needed seemed to work.

Upvotes: 2

Related Questions