由于Tensorflow问题,无法在本地运行Google ML引擎 [英] Cannot run Google ML engine locally due to Tensorflow issues

查看:141
本文介绍了由于Tensorflow问题,无法在本地运行Google ML引擎的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图通过运行命令 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'也没有任何问题。

解决方案 TensorFlow是否安装在虚拟环境中或非标准位置,当它从gcloud运行时不在Python路径中?



它有点笨拙但我会做以下检查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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆