Mac M1 - The Kernel appears to have died. It will restart automatically
Asked Answered
P

2

6

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?

Paramilitary answered 24/8, 2021 at 8:12 Comment(2)
import tensorflow in a python shell (not in jupyter), it should also crash, but the error message should be much more useful.Radiobiology
@Dr.Snoopy This is golden advice on your part - thank you - and in my case it was the dreaded HDF5_DISABLE_VERSION_CHECK=1 that strikes again!Repeat
E
5

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

Erlanger answered 31/8, 2021 at 3:22 Comment(4)
are you postdating your post!?Repeat
while installing through the command conda install -c apple tensorflow-deps it says pkg not found : tensorflow-deps.Eveleen
That did not work for me unfortunately. The kernel dies even faster...Scilicet
ERROR: Could not find a version that satisfies the requirement tensorflow-macos (from versions: none) ERROR: No matching distribution found for tensorflow-macos ERROR: Could not find a version that satisfies the requirement tensorflow-metal (from versions: none) ERROR: No matching distribution found for tensorflow-metalCandicecandid
C
1

This answer helped me, which refers to this site.

  1. Remove anaconda completely:

# 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

  1. only python 3.8 is compatible, you can run in an env, and run the notebook from there.

  2. miniforge3 will be instead of anaconda.

Candicecandid answered 23/8, 2022 at 14:16 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.