Ungraded lab week 1 - Kernel keeps dying in Jupyter lab

Hi. I am running into this issue whenever I try to run the 4th cell in the notebook from week 1 (as seen in screenshot).
I have tried running the notebook kernel several times on Conda virtual environment as well as on Docker and always get the same result.

Could it be a compatibility issue? For what its worth I am using a MacBook Pro M1.

I tried running the notebook on Google Colab and it works perfectly. Is there a way to fix so I could run it on my computer too?

Thanks.

As you mentioned it works on colab and I also tried on my Mac Intel, it is running fine.
I would suggest, taking each of the lines (modifying for completion) and try it out.
Unfortunately, I do not have access to Mac M1

Same issue here on Mac M1

After some research it looks like TF version 2.4 is M1 compatible. Could you try manually changing the version in requirements.txt from tensorflow==2.3.1 to tensorflow==2.4.1 and let me know if it works? This for the conda environment method since to update the library within the Docker image the setup is more complicated. If you already have the virtual env created you can just activate it and run pip install tensorflow==2.4.1.

1 Like

Thanks for sharing the info.

Same problem here and it can’t be your local machine’s issue as you would be running it on Coursera’s servers when using their browser.

Hi @a-zarta @satishnandi , I got the similar problem with Mac M1.

I tried each line of it, and figured out that: every time running “import cvlib as cv”, or “import tensorflow”, the kernel dies.

For tensorflow issue, I have manually changd the version in requirements.txt from tensorflow==2.3.1 to tensorflow==2.4.1, it did not work.

For cvlib issue, I have tried “pip install cvlib”, and it returned “Requirement already satisfied”. Then I restart the kernel and try to import cvlib again, the kernel still dies every time I try.

Besides, I have tried to build a new virtual environment and install tensorflow, cv2, cvlib module. Then I run week 1’s ungraded lab with the new venv, it works ok.

However, it’s actually a satisfying but not happy solution, because I need to install almost every module it need for every assignment, not as handy as Docker.

Still can’t stop the kernel to die yet…

Hi everyone
Some weeks ago I faced exactly the same problem under Windows 10 with Anaconda. My Anaconda environment was based on tensorflow 2.3.1.

I fixed the issue running

!pip3 install --upgrade tensorflow

at the beginning of the notebook. So tensorflow 2.5.0 was installed.
Hope this can help
Regards

Hi @fabioantonini, thanks for your suggestion.
I have tried that, and it did not work on Mac M1.

Then I check Tensorflow’s official document, and figure out pip installation does not support Mac M1 yet. So I guess installing in virtual environment is the only way to use tensorflow for Mac M1 users by now.

1 Like

I am in same boat as you @Damon. Still doesn’t work on my m1 chip.

Hi @srimac ,

Now I have two ways to deal with the exercises that I wanna practice locally:

  1. For those modules can be installed in Mac M1, I code with virtual environment.
  2. For those modules can not be installed in Mac M1, I code with Google Colab.

The embarrassed situation may be improved when MacOS 12.0 officially releases in later this year, which would be more compatible with machine learning stuff.

Keep coding.

Hello everyone
any news on this issue? I’m still having the same problem with a Mac M1 OS v 11.5.1. I tried the solutions above but any worked.

Same problem with Mac M1, OS 12.2.1. I tried following Apple’s instructions: Tensorflow Plugin - Metal - Apple Developer
but then get stuck installing project requirements.txt:
ERROR: Could not find a version that satisfies the requirement tensorflow==2.7.0
tried going down this road: AI - Apple Silicon Mac M1 natively supports TensorFlow 2.6 GPU acceleration (tensorflow-metal PluggableDevice) | MakeOptim
and ran into other problems.
Tried the docker approach instead and that crashes with “The TensorFlow library was compiled to use AVX instructions, but these aren’t available on your machine”. Hmmm.

That led me down another long dark and unsuccessful road:

Found a proposed solution in another thread, cross-linking here:

https://community.deeplearning.ai/t/kernel-crash-when-importing-tensorflow-or-cvlib-on-m1-macbook/78285

Wow, this is nasty. Mac M1 is shiny new tech but has its downsides.

Ok, I am back in the game, and still have same problem. I now have MacOS 12.4 and still doesn’t work. M1 has huge problems not just with this particular issue, but I have also noticed in many other issues. I am not happy that deeplearning.ai hasn’t added a note on this lab, that we should not attempt with apple m1 computers. It would save a lot of time if they included this in the notebook. ANYONE WHO HAS APPLE M1 (AT THIS TIME), DO NOT NOT DO THIS LAB LOCALLY.

Until a month or so ago, the only way to run this lab was locally. Now there is a coursera version of it which should be used by mac M1 users. Will add a note about this :slight_smile:

Anyone having difficulties setting up this lab on Apple M1 hardware as of mid-2022, check out esterjk’s solution here: Apple Mac M1 chip - #18 by estherjk

1 Like