Reputation: 569
I have just bought a new Macbook M1, and am struggling to use Jupyter notebook in it.
These are the steps that I followed so far:
1. Installed Homebrew
2. Installed pyenv
3. brew install miniforge
4. conda create -n new_env python=3.8.11
5. conda activate new_env
6. conda install Ipython
7. conda install ipykernel
8. conda install jupyter
9. pip install tensorflow
Then, I opened Jupyter notebook from this virtual env and tried to import tensorflow
which gave me the error 'The kernel appears to have died. It will restart automatically'
Why does this happen? Is there anything that I missed? Could someone please help me with this?
Upvotes: 6
Views: 26982
Reputation: 325
This answer helped me, which refers to this site.
# The following are a few examples of how you may need to delete your Anaconda folder
rm -rf anaconda3
rm -rf ~/anaconda3
rm -rf ~/opt/anaconda3
only python 3.8 is compatible, you can run in an env, and run the notebook from there.
miniforge3 will be instead of anaconda.
Upvotes: 1
Reputation: 156
There are not stable tensorflow for Apple Silicon today (2021-09-30). If you able to install via pip install tensorflow
, then you are using conda with amd64 and translated with Rosetta 2.
Go to https://github.com/conda-forge/miniforge and download Miniforge3-MacOSX-arm64.sh for arm64 version and install miniforge again.
bash Miniforge3-MacOSX-arm64.sh
Do
# Delete and create your environment from scratch
conda create -n new_env python=3.8
conda activate new_env
conda install -c apple tensorflow-deps
pip install tensorflow-macos
pip install tensorflow-metal
conda install -c conda-forge -y pandas jupyter
Then you able to run tensorflow without problem.
Source: https://caffeinedev.medium.com/how-to-install-tensorflow-on-m1-mac-8e9b91d93706
Upvotes: 5