Purushotham
Purushotham

Reputation: 31

SyntaxError: invalid syntax while running Job

The job is starting from the terminal with the following command;

gcloud ml-engine jobs submit training barcode_detection_eight --runtime-version 1.8 --job-dir gs://barcode-object-detection/model_dir --packages dist/object_detection-0.1.tar.gz,slim/dist/slim-0.1.tar.gz,../../pycocotools/pycocotools-2.0.tar.gz --module-name object_detection.model_main --region us-central1 --config object_detection/samples/cloud/cloud.yml -- --model_dir=gs://barcode-object-detection/model_dir --pipeline_config_path=gs://barcode-object-detection/data/faster_rcnn_resnet101_pets.config

After 5 minutes the Job is terminating with following error;

ps-replica-2 Command '['python3', '-m', 'object_detection.model_main', '--model_dir=gs://barcode-object-detection/model_dir', '--pipeline_config_path=gs://barcode-object-detection/data/faster_rcnn_resnet101_pets.config', '--job-dir', 'gs://barcode-object-detection/model_dir']' returned non-zero exit status 1

Also receiving the following series of invalid syntax errors;

{  insertId:  "1ma8zeeeuwhvz"    logName:  "projects/barcode-object-detection/logs/ml.googleapis.com%2Fbarcode_detection_eight" receiveTimestamp:  "2018-08-02T19:56:30.651437599Z"    resource: {   labels: {    job_id:  "barcode_detection_eight"        project_id:  "barcode-object-detection"        task_name:  "service"       }   type:  "ml_job"     }  severity:  "ERROR"    textPayload:  "The replica ps 0 exited with a non-zero status of 1. Termination reason: Error.  Traceback (most recent call last):   File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)   File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)   File "/root/.local/lib/python3.5/site-packages/object_detection/model_main.py", line 26, in <module>
    from object_detection import model_lib   File "/root/.local/lib/python3.5/site-packages/object_detection/model_lib.py", line 26, in <module>
    from object_detection import eval_util   File "/root/.local/lib/python3.5/site-packages/object_detection/eval_util.py", line 28, in <module>
    from object_detection.metrics import coco_evaluation   File "/root/.local/lib/python3.5/site-packages/object_detection/metrics/coco_evaluation.py", line 20, in <module>
    from object_detection.metrics import coco_tools   File "/root/.local/lib/python3.5/site-packages/object_detection/metrics/coco_tools.py", line 47, in <module>
    from pycocotools import coco   File "/root/.local/lib/python3.5/site-packages/pycocotools/coco.py", line 49
    import matplotlibnmatplotlib.use('Agg')nimport matplotlib.pyplot as plt
                                    ^ SyntaxError: invalid syntax

The replica ps 1 exited with a non-zero status of 1. Termination reason: Error.  Traceback (most recent call last):   File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)   File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)   File "/root/.local/lib/python3.5/site-packages/object_detection/model_main.py", line 26, in <module>
    from object_detection import model_lib   File "/root/.local/lib/python3.5/site-packages/object_detection/model_lib.py", line 26, in <module>
    from object_detection import eval_util   File "/root/.local/lib/python3.5/site-packages/object_detection/eval_util.py", line 28, in <module>
    from object_detection.metrics import coco_evaluation   File "/root/.local/lib/python3.5/site-packages/object_detection/metrics/coco_evaluation.py", line 20, in <module>
    from object_detection.metrics import coco_tools   File "/root/.local/lib/python3.5/site-packages/object_detection/metrics/coco_tools.py", line 47, in <module>
    from pycocotools import coco   File "/root/.local/lib/python3.5/site-packages/pycocotools/coco.py", line 49
    import matplotlibnmatplotlib.use('Agg')nimport matplotlib.pyplot as plt
                                    ^ SyntaxError: invalid syntax

The replica ps 2 exited with a non-zero status of 1. Termination reason: Error.  Traceback (most recent call last):   File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)   File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)   File "/root/.local/lib/python3.5/site-packages/object_detection/model_main.py", line 26, in <module>
    from object_detection import model_lib   File "/root/.local/lib/python3.5/site-packages/object_detection/model_lib.py", line 26, in <module>
    from object_detection import eval_util   File "/root/.local/lib/python3.5/site-packages/object_detection/eval_util.py", line 28, in <module>
    from object_detection.metrics import coco_evaluation   File "/root/.local/lib/python3.5/site-packages/object_detection/metrics/coco_evaluation.py", line 20, in <module>
    from object_detection.metrics import coco_tools   File "/root/.local/lib/python3.5/site-packages/object_detection/metrics/coco_tools.py", line 47, in <module>
    from pycocotools import coco   File "/root/.local/lib/python3.5/site-packages/pycocotools/coco.py", line 49
    import matplotlibnmatplotlib.use('Agg')nimport matplotlib.pyplot as plt
                                    ^ SyntaxError: invalid syntax

 timestamp:  "2018-08-02T19:56:30.651437599Z"   }

what does this error mean? I double checked the command syntax with the documentation, but still receiving this error. Experts help would be appreciated.

Upvotes: 3

Views: 669

Answers (1)

MatthewScarpino
MatthewScarpino

Reputation: 5936

According to the runtime version list, the Machine Learning Engine doesn't provide access to the matplotlib package. If you remove the dependency, will the application work?

Upvotes: 1

Related Questions