SyntaxError:运行Job时语法无效

时间:2018-08-03 13:53:13

标签: python-3.x tensorflow google-cloud-platform google-cloud-ml

作业是从终端使用以下命令启动的;

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

5分钟后,作业因以下错误而终止;

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

还会收到以下一系列无效的语法错误;

{  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"   }

此错误是什么意思?我在文档中仔细检查了命令语法,但仍然收到此错误。专家的帮助将不胜感激。

1 个答案:

答案 0 :(得分:1)

根据runtime version list,机器学习引擎不提供对matplotlib软件包的访问。如果您删除依赖关系,该应用程序将正常工作吗?