I was able to run on my M1 Mac with miniconda & installing TensorFlow & OpenCV as follows:
TensorFlow
Reference: Getting Started with tensorflow-metal PluggableDevice
Install Tensorflow dependencies:
conda install -c apple tensorflow-deps
Install base TensorFlow:
python -m pip install tensorflow-macos
Install tensorflow-metal plugin:
python -m pip install tensorflow-metal
OpenCV
Reference: How to Safely Install OpenCV on the Mac M1
Add conda-forge to your .condarc
config file:
conda config --add channels conda-forge
Install OpenCV:
conda install -c conda-forge opencv===4.5.3
Test that OpenCV has installed correctly by checking the version:
python -c "import cv2; print(cv2.__version__)"
This should print out the installed OpenCV Version:
4.5.3
Modifying requirements.txt
Comment out the following dependencies in requirements.txt
:
opencv-python-headless
tensorflow
See this modified README.