Search code examples
tensorflowgoogle-cloud-platforminstallationpython-importgcp-ai-platform-notebook

error message of No module named 'tensorflow' in GCP AI Platform Notebook


I launched a notebook with GCP AI Platform. Then, I tried to install tensorflow by:

import tensorflow as tf

There is an error message of

No module named 'tensorflow'

I tried to install it by:

!pip install -U --user tensorflow==1.14.0

But the same error message appeared. As it is a GCP platform, I wonder why I need to install tensorflow. During Coursera training, I can import tensorflow directly without installation. I wonder if I missed anything.

Grateful if you can help.

Thank you


Solution

  • You have probably selected an instance type that doesn't have tensorflow pre-installed.

    After you install a Python dependency you will have to restart the Python Kernel for updates to take effect by clicking on Kernel->Restart Kernel....