Advanced Designer Learning Path is now live! Read More

Keras/Tensorflow Model fails "ImportError: No module named tensorflow"

Level 1
Keras/Tensorflow Model fails "ImportError: No module named tensorflow"

Hi there guys!

I just installed Dataiku on MacOS (so gpu processing is not supported).

Trying to build a Deep learning model with keras and tensorflow, got an import error for tensorflow (using the default configuration/script).

Is there something I'm doing wrong?

Your help would be much appreciated.

The error:

[2019-05-23 15:57:36,358] [65612/MainThread] [INFO] [root] END - Fitting preprocessors
[2019-05-23 15:57:36,358] [65612/MainThread] [INFO] [root] START - Preprocessing train set
[2019-05-23 15:57:36,358] [65612/MainThread] [INFO] [root] END - Preprocessing train set
[2019-05-23 15:57:36,358] [65612/MainThread] [INFO] [root] START - Preprocessing test set
[2019-05-23 15:57:36,363] [65612/MainThread] [INFO] [root] END - Preprocessing test set
[2019-05-23 15:57:36,365] [65612/MainThread] [INFO] [root] START - Fitting model
[2019-05-23 15:57:36,367] [65612/MainThread] [INFO] [root] END - Fitting model
Traceback (most recent call last):
File "/Applications/", line 47, in serve
ret = api_command(arg)
File "/Applications/", line 45, in aux
return api(**kwargs)
File "/Applications/", line 419, in train_prediction_keras
File "/Applications/", line 350, in prediction_train_model_keras
File "/Applications/", line 26, in get_keras_model
[2019/05/23-15:57:36.367] [MRT-1323] [INFO] [] - Check result for nullity exceptionIfNull=true result=null
from import gpu
File "/Applications/", line 5, in <module>
import tensorflow as tf
ImportError: No module named tensorflow
[2019/05/23-15:57:36.462] [KNL-python-single-command-kernel-monitor-1327] [INFO] [dku.kernels] - Process done with code 0
[2019/05/23-15:57:36.465] [KNL-python-single-command-kernel-monitor-1327] [INFO] [] - Destroying API ticket for analysis-ml-ENERGY_PREDICTION_V1-kbMnWwD on behalf of admin
[2019/05/23-15:57:36.466] [MRT-1323] [INFO] [dku.kernels] - Getting kernel tail
[2019/05/23-15:57:36.467] [MRT-1323] [INFO] [dku.kernels] - Trying to enrich exception: Failed to train : <type 'exceptions.ImportError'> : No module named tensorflow from kernel com.dataiku.dip.analysis.coreservices.AnalysisMLKernel@6a50edbb process=null pid=?? retcode=0
[2019/05/23-15:57:36.467] [MRT-1323] [WARN] [] - Training failed Failed to train : <type 'exceptions.ImportError'> : No module named tensorflow


0 Kudos
4 Replies

Hello Bogdan,

It seems that you did not install the proper code environment to be able to run deep learning models.

Dataiku DSS is not shipped directly with Keras and Tensorflow, but offers the possibility to easily install them, and then use them in the visual Machine learning, to run deep learning models.

The steps to setup the appropriate code environment are detailed in the "Prerequisites" part of this tutorial:

Don't hesitate to come back to us if you have troubles installing the environment.


Best regards,

Nicolas Servel

0 Kudos
Level 1
Thank you!
Installed the code env and got model to work.
0 Kudos
Level 2

Hello, for the error AttributeError: module tensorflow has no attribute placeholder

you may like to check this link.

0 Kudos
Level 2

i have similar issue. i read the link and prepare my env and ensuring keras and tensorflow and scipy, scikit, xgs, are all installed and verified. but i still unable to get it working when i invoked commands to do "import keras or import tensorflow"

i had chosen visual learning of keras, tensorflow with gpu for cuda 9. I also confirmed i have the gpu as i able to access my gpu from my own terminal and run deep learning programs on it.


i am using cuda 10 on my machine


Using TensorFlow backend.
ImportError                               Traceback (most recent call last)
~/Downloads/DATA_DIR/code-envs/python/python36/lib/python3.6/site-packages/tensorflow/python/ in <module>
---> 58   from tensorflow.python.pywrap_tensorflow_internal import *
     59   from tensorflow.python.pywrap_tensorflow_internal import __version__

~/Downloads/DATA_DIR/code-envs/python/python36/lib/python3.6/site-packages/tensorflow/python/ in <module>
     27             return _mod
---> 28     _pywrap_tensorflow_internal = swig_import_helper()
     29     del swig_import_helper
0 Kudos
Labels (1)
A banner prompting to get Dataiku DSS