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

Highlighted
Bogdan
Level 1
Keras/Tensorflow Model fails "ImportError: No module named tensorflow"
Jump to solution

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/DataScienceStudio.app/Contents/Resources/kit/python/dataiku/doctor/server.py", line 47, in serve
ret = api_command(arg)
File "/Applications/DataScienceStudio.app/Contents/Resources/kit/python/dataiku/doctor/dkuapi.py", line 45, in aux
return api(**kwargs)
File "/Applications/DataScienceStudio.app/Contents/Resources/kit/python/dataiku/doctor/commands.py", line 419, in train_prediction_keras
pipeline.generated_features_mapping)
File "/Applications/DataScienceStudio.app/Contents/Resources/kit/python/dataiku/doctor/prediction_entrypoints.py", line 350, in prediction_train_model_keras
generated_features_mapping)
File "/Applications/DataScienceStudio.app/Contents/Resources/kit/python/dataiku/doctor/deep_learning/keras_support.py", line 26, in get_keras_model
[2019/05/23-15:57:36.367] [MRT-1323] [INFO] [dku.block.link.interaction] - Check result for nullity exceptionIfNull=true result=null
from dataiku.doctor.deep_learning import gpu
File "/Applications/DataScienceStudio.app/Contents/Resources/kit/python/dataiku/doctor/deep_learning/gpu.py", 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] [dip.tickets] - 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: com.dataiku.dip.io.SocketBlockLinkKernelException: 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] [dku.analysis.ml.python] - Training failed
com.dataiku.dip.io.SocketBlockLinkKernelException: Failed to train : <type 'exceptions.ImportError'> : No module named tensorflow
at com.dataiku.dip.io.SocketBlockLinkInteraction.throwExceptionFromPython(SocketBlockLinkInteraction.java:302)
at com.dataiku.dip.io.SocketBlockLinkInteraction$AsyncResult.checkException(SocketBlockLinkInteraction.java:215)
at com.dataiku.dip.io.SocketBlockLinkInteraction$AsyncResult.get(SocketBlockLinkInteraction.java:190)
at com.dataiku.dip.io.SingleCommandKernelLink$1.call(SingleCommandKernelLink.java:208)
at com.dataiku.dip.analysis.ml.prediction.PredictionTrainAdditionalThread.process(PredictionTrainAdditionalThread.java:75)
at com.dataiku.dip.analysis.ml.shared.PRNSTrainThread.run(PRNSTrainThread.java:130)


 

0 Kudos
1 Solution

Accepted Solutions
Nicolas_Servel Dataiker
Dataiker
Re: Keras/Tensorflow Model fails "ImportError: No module named tensorflow"
Jump to solution

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:



https://www.dataiku.com/learn/guide/visual/machine-learning/deep-learning-first.html



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



 



Best regards,



Nicolas Servel

View solution in original post

0 Kudos
3 Replies
Nicolas_Servel Dataiker
Dataiker
Re: Keras/Tensorflow Model fails "ImportError: No module named tensorflow"
Jump to solution

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:



https://www.dataiku.com/learn/guide/visual/machine-learning/deep-learning-first.html



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



 



Best regards,



Nicolas Servel

View solution in original post

0 Kudos
Bogdan
Level 1
Re: Keras/Tensorflow Model fails "ImportError: No module named tensorflow"
Jump to solution
Thank you!
Installed the code env and got model to work.
0 Kudos
sunrise100
Level 1
Re: Keras/Tensorflow Model fails "ImportError: No module named tensorflow"
Jump to solution

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



you may like to check this link.



https://botbark.com/2019/12/18/attributeerror-module-tensorflow-has-no-attribute-placeholder-tensorf...

0 Kudos
Labels (1)