Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python kernel dies when importing tensorflow 1.7

I want to use tensorflow insinde a Jupyter notebook. However, running

import tensorflow as tf

in a Jupyter notebook immediately triggers a pop-up:

The kernel appears to have died. It will restart automatically.

This issue only began after updating to tensorflow 1.7. I had not used tensorflow for a few weeks so it might also be due to an update to anaconda 5.1 with Python 3.6.

I use a Mid-2010 MacBookPro with "High Sierra 10.13.4". Removing and reinstalling anaconda 5.1 with Python 3.6, followed by installation of tensorflow (and not a single other library) via

pip3 install --upgrade tensorflow

did not resolve the issue. I do not use an isolated environment. The "anaconda3" folder is not in my home folder but directly in "Macintosh HD".

Before reinstalling anaconda, I removed it via these instructions https://docs.anaconda.com/anaconda/install/uninstall. I also did not try to run tensorflow outside Jupyter, simply because I do not know how. But even if I did, I would still like to use Jupyter.

like image 346
MD-ML Avatar asked Apr 24 '18 22:04

MD-ML


People also ask

Can Jupyter notebook run TensorFlow?

From the picture, python, jupyter and ipython are installed in the same environment. It means, you can use TensorFlow with a Jupyter Notebook.


2 Answers

I was facing the same issue with Tensorflow 2 '2.0.0-beta1'. I found out that when you have multiple notebooks with Tensorflow running, this problem occurs. Also, simply closing the unused notebook windows wont work, they're still running in the background, you'll have to 'Shutdown' the notebooks

Here are the steps to shutdown a notebooks:

> Go to Home (of Jupyter notebook) 
> Select 'Running' tab 
> Select the unused notebooks 
> Click 'Shutdown' button

You will notice in the Jupyter Home that the active notebook icon is green while inactive ones are gray

like image 128
SidK Avatar answered Oct 20 '22 14:10

SidK


I'm also running a Mid-2010 MacbookPro and have been facing the same issue. It seems the only solution is to downgrade to Tensorflow 1.5. You can do so by running the following:

pip3 uninstall tensorflow 
pip3 install tensorflow==1.5

Credit given to the solution to this post.

like image 7
kaimcg Avatar answered Oct 20 '22 15:10

kaimcg