在google cloud ml中导入librosa

时间:2017-02-10 21:31:42

标签: google-cloud-ml

我正在运行Google Cloud ML,当我尝试导入librosa时,我收到错误:

  

ImportError:没有名为_tkinter的模块,请安装python-tk软件包

我确实有一个setup.py文件,一个空的 __ init __。py 文件

Google Cloud的完整输出如下:

INFO    2017-02-10 12:45:53 -0800   unknown_task        Validating job requirements...
INFO    2017-02-10 12:45:53 -0800   unknown_task        Job creation request has been successfully validated.
INFO    2017-02-10 12:45:53 -0800   unknown_task        Job urbanSond_guyknaan_20170210_124543 is queued.
INFO    2017-02-10 12:46:02 -0800   unknown_task        Waiting for job to be provisioned.
INFO    2017-02-10 12:46:02 -0800   unknown_task        Waiting for TensorFlow to start.
INFO    2017-02-10 12:47:17 -0800   master-replica-0        Running task with arguments: --cluster={"master": ["master-f38da06f5f-0:2222"]} --task={"type": "master", "index": 0} --job={
INFO    2017-02-10 12:47:17 -0800   master-replica-0          "package_uris": ["gs://my-voices/urbanSond_guyknaan_20170210_124543/9819161857b70d709fcec911a98e4dee7b38c290/lib0.4.3.tar.gz", "gs://my-voices/urbanSond_guyknaan_20170210_124543/9819161857b70d709fcec911a98e4dee7b38c290/train-0.0.0.tar.gz"],
INFO    2017-02-10 12:47:17 -0800   master-replica-0          "python_module": "train.urbanSond_guyknaan_20170210_124543",
INFO    2017-02-10 12:47:17 -0800   master-replica-0          "args": ["--train_dir=gs://my-voices/urbanSond_guyknaan_20170210_124543/train", " "],
INFO    2017-02-10 12:47:17 -0800   master-replica-0          "region": "us-central1"
INFO    2017-02-10 12:47:17 -0800   master-replica-0        } --beta
INFO    2017-02-10 12:47:18 -0800   master-replica-0        Running module train.urbanSond_guyknaan_20170210_124543.
INFO    2017-02-10 12:47:18 -0800   master-replica-0        Downloading the package: gs://my-voices/urbanSond_guyknaan_20170210_124543/9819161857b70d709fcec911a98e4dee7b38c290/lib0.4.3.tar.gz
INFO    2017-02-10 12:47:18 -0800   master-replica-0        Running command: gsutil -q cp gs://my-voices/urbanSond_guyknaan_20170210_124543/9819161857b70d709fcec911a98e4dee7b38c290/lib0.4.3.tar.gz lib0.4.3.tar.gz
INFO    2017-02-10 12:47:19 -0800   master-replica-0        Installing the package: gs://my-voices/urbanSond_guyknaan_20170210_124543/9819161857b70d709fcec911a98e4dee7b38c290/lib0.4.3.tar.gz
INFO    2017-02-10 12:47:19 -0800   master-replica-0        Running command: pip install --user --upgrade --force-reinstall lib0.4.3.tar.gz
INFO    2017-02-10 12:47:20 -0800   master-replica-0        Processing ./lib0.4.3.tar.gz
INFO    2017-02-10 12:47:21 -0800   master-replica-0        Collecting audioread>=2.0.0 (from librosa==0.4.3)
INFO    2017-02-10 12:47:21 -0800   master-replica-0          Downloading audioread-2.1.4.tar.gz
INFO    2017-02-10 12:47:21 -0800   master-replica-0        Collecting numpy>=1.8.0 (from librosa==0.4.3)
INFO    2017-02-10 12:47:22 -0800   master-replica-0          Downloading numpy-1.12.0-cp27-cp27mu-manylinux1_x86_64.whl (16.5MB)
INFO    2017-02-10 12:47:25 -0800   master-replica-0        Collecting scipy>=0.13.0 (from librosa==0.4.3)
INFO    2017-02-10 12:47:25 -0800   master-replica-0          Downloading scipy-0.18.1-cp27-cp27mu-manylinux1_x86_64.whl (40.3MB)
INFO    2017-02-10 12:47:33 -0800   master-replica-0        Collecting scikit-learn>=0.14.0 (from librosa==0.4.3)
INFO    2017-02-10 12:47:33 -0800   master-replica-0          Downloading scikit_learn-0.18.1-cp27-cp27mu-manylinux1_x86_64.whl (11.6MB)
INFO    2017-02-10 12:47:34 -0800   master-replica-0        Collecting matplotlib>=1.4.3 (from librosa==0.4.3)
INFO    2017-02-10 12:47:35 -0800   master-replica-0          Downloading matplotlib-2.0.0-1-cp27-cp27mu-manylinux1_x86_64.whl (14.6MB)
INFO    2017-02-10 12:47:37 -0800   master-replica-0        Collecting joblib>=0.7.0 (from librosa==0.4.3)
INFO    2017-02-10 12:47:37 -0800   master-replica-0          Downloading joblib-0.10.3-py2.py3-none-any.whl (166kB)
INFO    2017-02-10 12:47:37 -0800   master-replica-0        Collecting decorator>=3.0.0 (from librosa==0.4.3)
INFO    2017-02-10 12:47:37 -0800   master-replica-0          Downloading decorator-4.0.11-py2.py3-none-any.whl
INFO    2017-02-10 12:47:37 -0800   master-replica-0        Collecting six>=1.3 (from librosa==0.4.3)
INFO    2017-02-10 12:47:37 -0800   master-replica-0          Downloading six-1.10.0-py2.py3-none-any.whl
INFO    2017-02-10 12:47:37 -0800   master-replica-0        Collecting resampy>=0.1.0 (from librosa==0.4.3)
INFO    2017-02-10 12:47:37 -0800   master-replica-0          Downloading resampy-0.1.4.tar.gz (442kB)
INFO    2017-02-10 12:47:38 -0800   master-replica-0        Collecting pytz (from matplotlib>=1.4.3->librosa==0.4.3)
INFO    2017-02-10 12:47:38 -0800   master-replica-0          Downloading pytz-2016.10-py2.py3-none-any.whl (483kB)
INFO    2017-02-10 12:47:38 -0800   master-replica-0        Collecting pyparsing!=2.0.0,!=2.0.4,!=2.1.2,!=2.1.6,>=1.5.6 (from matplotlib>=1.4.3->librosa==0.4.3)
INFO    2017-02-10 12:47:39 -0800   master-replica-0          Downloading pyparsing-2.1.10-py2.py3-none-any.whl (56kB)
INFO    2017-02-10 12:47:39 -0800   master-replica-0        Collecting python-dateutil (from matplotlib>=1.4.3->librosa==0.4.3)
INFO    2017-02-10 12:47:39 -0800   master-replica-0          Downloading python_dateutil-2.6.0-py2.py3-none-any.whl (194kB)
INFO    2017-02-10 12:47:39 -0800   master-replica-0        Collecting cycler>=0.10 (from matplotlib>=1.4.3->librosa==0.4.3)
INFO    2017-02-10 12:47:39 -0800   master-replica-0          Downloading cycler-0.10.0-py2.py3-none-any.whl
INFO    2017-02-10 12:47:39 -0800   master-replica-0        Collecting subprocess32 (from matplotlib>=1.4.3->librosa==0.4.3)
INFO    2017-02-10 12:47:39 -0800   master-replica-0          Downloading subprocess32-3.2.7.tar.gz (54kB)
INFO    2017-02-10 12:47:39 -0800   master-replica-0        Collecting functools32 (from matplotlib>=1.4.3->librosa==0.4.3)
INFO    2017-02-10 12:47:39 -0800   master-replica-0          Downloading functools32-3.2.3-2.zip
INFO    2017-02-10 12:47:40 -0800   master-replica-0        Collecting Cython>=0.23 (from resampy>=0.1.0->librosa==0.4.3)
INFO    2017-02-10 12:47:40 -0800   master-replica-0          Downloading Cython-0.25.2-cp27-cp27mu-manylinux1_x86_64.whl (6.4MB)
INFO    2017-02-10 12:47:41 -0800   master-replica-0        Building wheels for collected packages: audioread, resampy, subprocess32, functools32
INFO    2017-02-10 12:47:41 -0800   master-replica-0          Running setup.py bdist_wheel for audioread: started
INFO    2017-02-10 12:47:41 -0800   master-replica-0        creating '/tmp/tmpg4lEN9pip-wheel-/audioread-2.1.4-cp27-none-any.whl' and adding '.' to it
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread/macca.py'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread/rawread.py'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread/__init__.py'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread/ffdec.py'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread/maddec.py'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread/gstdec.py'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread-2.1.4.dist-info/DESCRIPTION.rst'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread-2.1.4.dist-info/metadata.json'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread-2.1.4.dist-info/top_level.txt'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread-2.1.4.dist-info/WHEEL'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread-2.1.4.dist-info/METADATA'
INFO    2017-02-10 12:47:41 -0800   master-replica-0        adding 'audioread-2.1.4.dist-info/RECORD'
INFO    2017-02-10 12:47:41 -0800   master-replica-0          Running setup.py bdist_wheel for audioread: finished with status 'done'
INFO    2017-02-10 12:47:41 -0800   master-replica-0          Stored in directory: /root/.cache/pip/wheels/62/1b/49/0384c1e62978b50f516e813410d2d5f466a9a4fe520790f105
INFO    2017-02-10 12:47:41 -0800   master-replica-0          Running setup.py bdist_wheel for resampy: started
INFO    2017-02-10 12:47:47 -0800   master-replica-0        creating '/tmp/tmpQPxuVIpip-wheel-/resampy-0.1.4-cp27-cp27mu-linux_x86_64.whl' and adding '.' to it
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy/__init__.py'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy/filters.py'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy/core.py'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy/version.py'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy/interp.so'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy/data/kaiser_best.npz'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy/data/kaiser_fast.npz'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy-0.1.4.dist-info/DESCRIPTION.rst'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy-0.1.4.dist-info/metadata.json'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy-0.1.4.dist-info/pbr.json'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy-0.1.4.dist-info/top_level.txt'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy-0.1.4.dist-info/WHEEL'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy-0.1.4.dist-info/METADATA'
INFO    2017-02-10 12:47:47 -0800   master-replica-0        adding 'resampy-0.1.4.dist-info/RECORD'
INFO    2017-02-10 12:47:47 -0800   master-replica-0          Running setup.py bdist_wheel for resampy: finished with status 'done'
INFO    2017-02-10 12:47:47 -0800   master-replica-0          Stored in directory: /root/.cache/pip/wheels/a4/64/9a/bb674db6afe6313c225007204444cde44766da4f2d6b5e6992
INFO    2017-02-10 12:47:47 -0800   master-replica-0          Running setup.py bdist_wheel for subprocess32: started
INFO    2017-02-10 12:47:48 -0800   master-replica-0        creating '/tmp/tmpP5JLP3pip-wheel-/subprocess32-3.2.7-cp27-cp27mu-linux_x86_64.whl' and adding '.' to it
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding '_posixsubprocess.so'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'subprocess32.py'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'subprocess32-3.2.7.dist-info/DESCRIPTION.rst'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'subprocess32-3.2.7.dist-info/metadata.json'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'subprocess32-3.2.7.dist-info/top_level.txt'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'subprocess32-3.2.7.dist-info/WHEEL'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'subprocess32-3.2.7.dist-info/METADATA'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'subprocess32-3.2.7.dist-info/RECORD'
INFO    2017-02-10 12:47:48 -0800   master-replica-0          Running setup.py bdist_wheel for subprocess32: finished with status 'done'
INFO    2017-02-10 12:47:48 -0800   master-replica-0          Stored in directory: /root/.cache/pip/wheels/7d/4c/a4/ce9ceb463dae01f4b95e670abd9afc8d65a45f38012f8030cc
INFO    2017-02-10 12:47:48 -0800   master-replica-0          Running setup.py bdist_wheel for functools32: started
INFO    2017-02-10 12:47:48 -0800   master-replica-0        creating '/tmp/tmp4LxARcpip-wheel-/functools32-3.2.3.post2-cp27-none-any.whl' and adding '.' to it
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'functools32/reprlib32.py'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'functools32/_dummy_thread32.py'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'functools32/__init__.py'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'functools32/functools32.py'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'functools32-3.2.3.post2.dist-info/DESCRIPTION.rst'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'functools32-3.2.3.post2.dist-info/metadata.json'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'functools32-3.2.3.post2.dist-info/top_level.txt'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'functools32-3.2.3.post2.dist-info/WHEEL'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'functools32-3.2.3.post2.dist-info/METADATA'
INFO    2017-02-10 12:47:48 -0800   master-replica-0        adding 'functools32-3.2.3.post2.dist-info/RECORD'
INFO    2017-02-10 12:47:48 -0800   master-replica-0          Running setup.py bdist_wheel for functools32: finished with status 'done'
INFO    2017-02-10 12:47:48 -0800   master-replica-0          Stored in directory: /root/.cache/pip/wheels/3c/d0/09/cd78d0ff4d6cfecfbd730782a7815a4571cd2cd4d2ed6e69d9
INFO    2017-02-10 12:47:48 -0800   master-replica-0        Successfully built audioread resampy subprocess32 functools32
INFO    2017-02-10 12:47:48 -0800   master-replica-0        Installing collected packages: audioread, numpy, scipy, scikit-learn, pytz, six, pyparsing, python-dateutil, cycler, subprocess32, functools32, matplotlib, joblib, decorator, Cython, resampy, librosa
INFO    2017-02-10 12:47:55 -0800   master-replica-0          Running setup.py install for librosa: started
INFO    2017-02-10 12:47:55 -0800   master-replica-0            Running setup.py install for librosa: finished with status 'done'
INFO    2017-02-10 12:47:55 -0800   master-replica-0        Successfully installed Cython-0.25.2 audioread-2.1.4 cycler-0.10.0 decorator-4.0.11 functools32-3.2.3.post2 joblib-0.10.3 librosa-0.4.3 matplotlib-2.0.0 numpy-1.12.0 pyparsing-2.1.10 python-dateutil-2.6.0 pytz-2016.10 resampy-0.1.4 scikit-learn-0.18.1 scipy-0.18.1 six-1.10.0 subprocess32-3.2.7
INFO    2017-02-10 12:47:56 -0800   master-replica-0        Downloading the package: gs://my-voices/urbanSond_guyknaan_20170210_124543/9819161857b70d709fcec911a98e4dee7b38c290/train-0.0.0.tar.gz
INFO    2017-02-10 12:47:56 -0800   master-replica-0        Running command: gsutil -q cp gs://my-voices/urbanSond_guyknaan_20170210_124543/9819161857b70d709fcec911a98e4dee7b38c290/train-0.0.0.tar.gz train-0.0.0.tar.gz
INFO    2017-02-10 12:47:57 -0800   master-replica-0        Installing the package: gs://my-voices/urbanSond_guyknaan_20170210_124543/9819161857b70d709fcec911a98e4dee7b38c290/train-0.0.0.tar.gz
INFO    2017-02-10 12:47:57 -0800   master-replica-0        Running command: pip install --user --upgrade --force-reinstall train-0.0.0.tar.gz
INFO    2017-02-10 12:47:58 -0800   master-replica-0        Processing ./train-0.0.0.tar.gz
INFO    2017-02-10 12:47:58 -0800   master-replica-0        Building wheels for collected packages: train
INFO    2017-02-10 12:47:58 -0800   master-replica-0          Running setup.py bdist_wheel for train: started
INFO    2017-02-10 12:47:59 -0800   master-replica-0        creating '/tmp/tmpn8aLxTpip-wheel-/train-0.0.0-cp27-none-any.whl' and adding '.' to it
INFO    2017-02-10 12:47:59 -0800   master-replica-0        adding 'train/run.py'
INFO    2017-02-10 12:47:59 -0800   master-replica-0        adding 'train/__init__.py'
INFO    2017-02-10 12:47:59 -0800   master-replica-0        adding 'train/setup.py'
INFO    2017-02-10 12:47:59 -0800   master-replica-0        adding 'train/urbanSond_guyknaan_20170210_124543.py'
INFO    2017-02-10 12:47:59 -0800   master-replica-0        adding 'train-0.0.0.dist-info/DESCRIPTION.rst'
INFO    2017-02-10 12:47:59 -0800   master-replica-0        adding 'train-0.0.0.dist-info/metadata.json'
INFO    2017-02-10 12:47:59 -0800   master-replica-0        adding 'train-0.0.0.dist-info/top_level.txt'
INFO    2017-02-10 12:47:59 -0800   master-replica-0        adding 'train-0.0.0.dist-info/WHEEL'
INFO    2017-02-10 12:47:59 -0800   master-replica-0        adding 'train-0.0.0.dist-info/METADATA'
INFO    2017-02-10 12:47:59 -0800   master-replica-0        adding 'train-0.0.0.dist-info/RECORD'
INFO    2017-02-10 12:47:59 -0800   master-replica-0          Running setup.py bdist_wheel for train: finished with status 'done'
INFO    2017-02-10 12:47:59 -0800   master-replica-0          Stored in directory: /root/.cache/pip/wheels/45/48/75/d931bb937bb1cb4558cc210e4cdc3be905e66eb958d7942922
INFO    2017-02-10 12:47:59 -0800   master-replica-0        Successfully built train
INFO    2017-02-10 12:47:59 -0800   master-replica-0        Installing collected packages: train
INFO    2017-02-10 12:47:59 -0800   master-replica-0        Successfully installed train-0.0.0
INFO    2017-02-10 12:47:59 -0800   master-replica-0        Running command: python -m train.urbanSond_guyknaan_20170210_124543 --train_dir=gs://my-voices/urbanSond_guyknaan_20170210_124543/train
INFO    2017-02-10 12:48:00 -0800   master-replica-0        Reading package lists...
INFO    2017-02-10 12:48:00 -0800   master-replica-0        Building dependency tree...
INFO    2017-02-10 12:48:00 -0800   master-replica-0        Reading state information...
INFO    2017-02-10 12:48:00 -0800   master-replica-0        Package python-tk is not available, but is referred to by another package.
ERROR   2017-02-10 12:48:00 -0800   master-replica-0        E: Package 'python-tk' has no installation candidate
INFO    2017-02-10 12:48:00 -0800   master-replica-0        This may mean that the package is missing, has been obsoleted, or
INFO    2017-02-10 12:48:00 -0800   master-replica-0        is only available from another source
ERROR   2017-02-10 12:48:02 -0800   master-replica-0        Traceback (most recent call last):
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            "__main__", fname, loader, pkg_name)
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            exec code in run_globals
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/root/.local/lib/python2.7/site-packages/train/urbanSond_guyknaan_20170210_124543.py", line 5, in <module>
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            import librosa
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/root/.local/lib/python2.7/site-packages/librosa/__init__.py", line 18, in <module>
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            from . import display
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/root/.local/lib/python2.7/site-packages/librosa/display.py", line 21, in <module>
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            import matplotlib.pyplot as plt
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/root/.local/lib/python2.7/site-packages/matplotlib/pyplot.py", line 115, in <module>
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            _backend_mod, new_figure_manager, draw_if_interactive, _show = pylab_setup()
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/root/.local/lib/python2.7/site-packages/matplotlib/backends/__init__.py", line 32, in pylab_setup
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            globals(),locals(),[backend_name],0)
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/root/.local/lib/python2.7/site-packages/matplotlib/backends/backend_tkagg.py", line 6, in <module>
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            from six.moves import tkinter as Tk
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/root/.local/lib/python2.7/site-packages/six.py", line 203, in load_module
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            mod = mod._resolve()
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/root/.local/lib/python2.7/site-packages/six.py", line 115, in _resolve
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            return _import_module(self.mod)
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/root/.local/lib/python2.7/site-packages/six.py", line 82, in _import_module
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            __import__(name)
ERROR   2017-02-10 12:48:02 -0800   master-replica-0          File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 42, in <module>
ERROR   2017-02-10 12:48:02 -0800   master-replica-0            raise ImportError, str(msg) + ', please install the python-tk package'
ERROR   2017-02-10 12:48:02 -0800   master-replica-0        ImportError: No module named _tkinter, please install the python-tk package
ERROR   2017-02-10 12:48:02 -0800   master-replica-0        Module raised an exception Command '['python', '-m', u'train.urbanSond_guyknaan_20170210_124543', u'--train_dir=gs://my-voices/urbanSond_guyknaan_20170210_124543/train', u' ']' returned non-zero exit status 1.
INFO    2017-02-10 12:48:02 -0800   master-replica-0        Module completed; cleaning up.
INFO    2017-02-10 12:48:02 -0800   master-replica-0        Clean up finished.
ERROR   2017-02-10 12:48:18 -0800   unknown_task        Your main program exited with a non-zero status of 1. Program exit details: exit_code: 1
ERROR   2017-02-10 12:48:18 -0800   unknown_task        reason: "Error"
ERROR   2017-02-10 12:48:18 -0800   unknown_task        message: "{\"exit_code\": 1}\n"
ERROR   2017-02-10 12:48:18 -0800   unknown_task        started_at {
ERROR   2017-02-10 12:48:18 -0800   unknown_task          seconds: 1486759637
ERROR   2017-02-10 12:48:18 -0800   unknown_task        }
ERROR   2017-02-10 12:48:18 -0800   unknown_task        finished_at {
ERROR   2017-02-10 12:48:18 -0800   unknown_task          seconds: 1486759682
ERROR   2017-02-10 12:48:18 -0800   unknown_task        }
ERROR   2017-02-10 12:48:18 -0800   unknown_task        container_id: "docker://4b187759bee0b9485031268bf9246a2f6998b691c15c6b4a267119056705d562". To find out more about why your job exited please check the logs: https://console.cloud.google.com/logs/viewer?project=607563698752&resource=ml.googleapis.com%2Fjob_id%2FurbanSond_guyknaan_20170210_124543&logName=&advancedFilter=metadata.serviceName%3D%22ml.googleapis.com%22%0Ametadata.labels.%22ml.googleapis.com%2Fjob_id%22%3D%22urbanSond_guyknaan_20170210_124543%22%0A
endTime: '2017-02-10T12:48:18'
jobId: urbanSond_guyknaan_20170210_124543
startTime: '2017-02-10T12:47:44'
state: FAILED

1 个答案:

答案 0 :(得分:1)

您需要通过修改setup.py来安装python-tk软件包,将其作为依赖项引入。由于它是一个apt包,你可以修改你的setup.py文件,通过apt安装它。这是一个示例setup.py文件的样子。

import logging
import subprocess
from setuptools import find_packages
from setuptools import setup
from setuptools.command.install import install

# Some custom command to run during setup. Typically, these commands will
# include steps to install non-Python packages.
#
# First, note that there is no need to use the sudo command because the setup
# script runs with appropriate access.
# Second, if apt-get tool is used then the first command needs to be 'apt-get
# update' so the tool refreshes itself and initializes links to download
# repositories.  Without this initial step the other apt-get install commands
# will fail with package not found errors. Note also --assume-yes option which
# shortcuts the interactive confirmation.
#
# The output of custom commands (including failures) will be logged.


class CustomCommands(install):
  """A setuptools Command class able to run arbitrary commands."""

  def RunCustomCommand(self, command_list):
    print 'Running command: %s' % command_list
    p = subprocess.Popen(
        command_list,
        stdin=subprocess.PIPE,
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT)
    # Can use communicate(input='y\n'.encode()) if the command run requires
    # some confirmation.
    stdout_data, _ = p.communicate()
    print 'Command output: %s' % stdout_data
    logging.info('Log command output: %s', stdout_data)
    if p.returncode != 0:
      raise RuntimeError('Command %s failed: exit code: %s' %
                         (command_list, p.returncode))

  def run(self):
    self.RunCustomCommand(['apt-get', 'update'])
    self.RunCustomCommand(
          ['sudo', 'apt-get', 'install', '-y', 'python-tk'])

    install.run(self)


REQUIRED_PACKAGES = []

setup(
    name='my-package',
    version='0.1.1',
    author='Author',
    author_email='author@gmail.com',
    install_requires=REQUIRED_PACKAGES,
    packages=find_packages(),
    description='Description',
    requires=[],
    cmdclass={
        # Command class instantiated and run during install scenarios.
        'install': CustomCommands,
    })