Cannot run Google ML engine locally due to Tensorflow issues

你。 提交于 2019-12-02 22:11:49

问题


I'm trying to run the Google Cloud ML engine locally for debugging purposes by running the command gcloud ml-engine local predict --model-dir=fasttext_cloud/ --json-instances=debug_instance.json. However, I'm getting the error: ERROR: (gcloud.ml-engine.local.predict) Cannot import Tensorflow.

This is strange as Tensorflow works fine on my machine. Even a simple example like python -c 'import tensorflow' has no issues whatsoever.


回答1:


Is TensorFlow installed in a virtual environment or a non-standard location that isn't on the Python path when running from gcloud?

Its a bit kludgy but I would do the following to check the Python path being used by gcloud. Modify the file

${GCLOUD_INSTALL_LOCATION}/google-cloud-sdk/lib/surface/ml_engine/__init__.py

At the top of the file add

import sys
print("\n".join(sys.path))

Then run

gcloud ml-engine

This should print out the python path and you can now check that it includes the location where TensorFlow is installed.




回答2:


Can you upgrade to the latest gcloud release (171.0.0) and retry? To upgrade, run

$ gcloud components update



来源:https://stackoverflow.com/questions/45809554/cannot-run-google-ml-engine-locally-due-to-tensorflow-issues

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