Cannot run Google ML engine locally due to Tensorflow issues
Asked Answered
R

2

0

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.

Remonaremonetize answered 22/8, 2017 at 5:32 Comment(0)
E
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.

Entente answered 22/8, 2017 at 11:14 Comment(2)
It's installed using anaconda, not in a virtual environment. It's available when running python -c 'import tensorflow' so I would think that it's on the Python path. However, I can try to examine that more if you give me a bit of guidance how to do that?Remonaremonetize
I updated my answer to include a suggestion on how to check the path.Entente
S
0

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

$ gcloud components update

Scudo answered 19/9, 2017 at 6:21 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.