由于Tensorflow问题,无法在本地运行Google ML引擎 [英] Cannot run Google ML engine locally due to Tensorflow issues
问题描述
我试图通过运行命令 gcloud ml-engine local predict --model-dir = fasttext_cloud / --json-instances = debug_instance来在本地运行Google Cloud ML引擎以进行调试。 JSON
。但是,我收到错误:错误:(gcloud.ml-engine.local.predict)无法导入Tensorflow。
这很奇怪,因为Tensorflow在我的机器上正常工作。即使是一个简单的例子,像 python -c'import tensorflow'
也没有任何问题。
它有点笨拙但我会做以下检查gcloud正在使用的Python路径。修改文件
$ {GCLOUD_INSTALL_LOCATION} / google-cloud-sdk / lib / surface / ml_engine / __ init__.py
在文件顶部添加
import sys
print(\\\
.join(sys.path))
然后运行
gcloud ml-engine
这应该打印python路径,现在可以检查它是否包含TensorFlow的安装位置。
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.
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.
这篇关于由于Tensorflow问题,无法在本地运行Google ML引擎的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!