user4234032
user4234032

Reputation:

ML Engine Python Version Issue

While going through a flower classification tutorial, I ran into a python issue. Trying to run the trainer preprocess script with the command

python trainer/preprocess.py \
    --input_dict "$DICT_FILE" \
    --input_path "gs://cloud-ml-data/img/flower_photos/eval_set.csv" \
    --output_path "${GCS_PATH}/preproc/eval" \
    --cloud

I get the following error;

Traceback (most recent call last):
  File "trainer/preprocess.py", line 71, in <module>
    import apache_beam as beam
  File "/Users/some_guy/Documents/Programs/ML/cmle-env/lib/python3.6/site-packages/apache_beam/__init__.py", line 72, in <module>
    'It is not supported on Python [%s].' % sys.version_info)
TypeError: not all arguments converted during string formatting

This sounds like my (virtualenv?) path has the wrong python.

python -V returns

Python 3.6.3 :: Anaconda, Inc.

Which may be wrong, because my cmle-env is activated (it prefixes my terminal prompt), so I thought the cmle-env would know the right python version to use so that I don't run into dependency issues. I followed the tutorial instructions verbatim, and had gotten a previous census data tutorial to work just fine before (within the same gcloud project).

I am very new to gcloud and virtualenv so maybe I missed something (e.g. it is strange that python -V returns anaconda 3.6, which is on my host and I don't believe has anything to do with the activated cmle-env).

TLDR: How do I get my cmle-env to use the proper python version so that I can run the flower tutorial trainer? I really want to continue - these are fantastic other than python issues.

This is run on MacOS High Sierra 10.13.3

Upvotes: 0

Views: 154

Answers (2)

Lefteris S
Lefteris S

Reputation: 1672

Make sure to specify the python version you want when you create the virtualenv using the --python or -p option, as in:

$ virtualenv -p /path/to/python2.7 cmle-env

Upvotes: 0

phd
phd

Reputation: 94407

It's a bug in Apache Beam and it was fixed a year ago: https://github.com/apache/beam/commit/30b5fe552cbf40a6914d327ac5455394ee615493

Upvotes: 1

Related Questions