Forty — a fine season for coding TensorFlow.
I'm taking a class on visual intelligence AI. I had been using Colab the whole time, but to prepare for the final project I'm gradually moving the class material to my local machine.
I don't have a computer with NVIDIA hardware, only a MacBook M1, so I looked up the necessary environment setup via Google and am leaving a record here for later.
Fortunately, the class is taught with Keras instead of PyTorch.
Create a virtual environment
python3 -m venv ~/venv-metal
Activate the virtual environment
source ~/venv-metal/bin/activate
Update pip
python -m pip install -U pip
Install TensorFlow
python3 -m pip install tensorflow-macos
*option** python -m pip install tensorflow
Install the TensorFlow Mac plugin
python -m pip install tensorflow-metal
Install any other dependencies you need
pip install package-name
Run Python
python3 yourScript.py
Other things to check - if you happen to get an error,
Is the CLI (terminal) you're typing in actually running inside the virtual environment you installed?
Are the packages you installed installed inside the virtual environment you set up this time, rather than in another virtual environment or the base local environment?
Is the IDE's Python interpreter the same version as the Python in the virtual environment you installed?
For the related content I referred to the Mac official site.
https://developer.apple.com/metal/tensorflow-plugin/
