Python kernel dies when importing tensorflow 1.7

◇◆丶佛笑我妖孽 提交于 2019-12-10 12:44:30

问题


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.


回答1:


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.




回答2:


I have also faced a similar issue. I was using python 3.7 and Tensorflow version 1.5 For we moving to Python 3.5 solve the issue.




回答3:


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



来源:https://stackoverflow.com/questions/50011676/python-kernel-dies-when-importing-tensorflow-1-7

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!