Reputation: 989
I am reading "Hands-On Machine Learning with Scikit-Learn, Keras and Tensorflow"
and installed Tensorflow 2
as follows:
$ python3 -m pip install --upgrade tensorflow
In the jupyter notebook
I tried to import Tensorflow
as follows:
import tensorflow as tf
But then I get the following error message:
The kernel appears to have died. It will restart automatically
I know there is a bunch of StackOverflow threads about this topic. I have read them all. Some of them are old, some are new. Most of them suggest to downgrade the Tensorflow
version to 1.5. But when I do that I can not use some of the methods of the Keras API
(e.g. load_data()
could not be found).
Is there anyone who have found a solution for that?
Upvotes: 2
Views: 9102
Reputation: 614
The second version of the textbook is all about TensorFlow version 2 so you have to use TensorFlow version 2 to use code. if there is a problem get the first version of the textbook which uses TensorFlow 1.
But I suggest learning TensorFlow 2 as it is the latest version.
if you are using anaconda Try installing TensorFlow 2 in a new environment.
To create a new environment open anaconda prompt.
conda create -n envname python=3.6
and then activate the environment
activate envname
Now try installing TensorFlow 2 and other necessary modules and check.
If it does not work the best solution is to use google colab(colab.research.google.com/).where you can do everything online, you can even have free GPU.
Upvotes: 2