Ошибка установки модуля DockerSkeleton Python ML - PullRequest
0 голосов
/ 05 сентября 2018

Я пытаюсь установить модули python ml через dockerSkeleton, чтобы я мог вызвать действие docker из openwhisk cli, но я продолжаю получать ошибки ниже и не могу найти много помощи.

  Collecting scikit-learn (from sklearn->-r requirements.txt (line 4))
    Downloading https://files.pythonhosted.org/packages/25/b6    /454cf208be93efa3db50ce06b732328c57ede005d1dcfa71d9a1548530b0/scikit-learn-0.19.2.tar.gz (9.7MB)
    Building wheels for collected packages: numpy, elm, scipy, sklearn, deap, optunity, scikit-learn
    Running setup.py bdist_wheel for numpy: started
    Running setup.py bdist_wheel for numpy: still running...
  Running setup.py bdist_wheel for numpy: still running...
  Running setup.py bdist_wheel for numpy: still running...
  Running setup.py bdist_wheel for numpy: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/29/74/5c/331da973b82cedd300e088ad58bd241c4c8857dd6faf5433eb
  Running setup.py bdist_wheel for elm: started
  Running setup.py bdist_wheel for elm: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/31/17/21/20fd245c9d2b1db0e4805d9e3a9b36c2767ce4816378548cf7
  Running setup.py bdist_wheel for scipy: started
  Running setup.py bdist_wheel for scipy: finished with status 'error'
  Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-jprwp998/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-st6v_gb2 --python-tag cp36:
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-jprwp998/scipy/setup.py", line 474, in <module>
      setup_package()
    File "/tmp/pip-install-jprwp998/scipy/setup.py", line 450, in setup_package
      from numpy.distutils.core import setup
  ModuleNotFoundError: No module named 'numpy'

  ----------------------------------------
  Failed building wheel for scipy
  Running setup.py clean for scipy
  Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-jprwp998/scipy/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" clean --all:

  `setup.py clean` is not supported, use one of the following instead:

    - `git clean -xdf` (cleans all files)
    - `git clean -Xdf` (cleans all versioned files, doesn't touch
                        files that aren't checked into the git repo)

  Add `--force` to your command to use it anyway if you must (unsupported).


  ----------------------------------------
  Failed cleaning build dir for scipy
  Running setup.py bdist_wheel for sklearn: started
  Running setup.py bdist_wheel for sklearn: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/76/03/bb/589d421d27431bcd2c6da284d5f2286c8e3b2ea3cf1594c074
  Running setup.py bdist_wheel for deap: started
  Running setup.py bdist_wheel for deap: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/22/ea/bf/dc7c8a2262025a0ab5da9ef02282c198be88902791ca0c6658
  Running setup.py bdist_wheel for optunity: started
  Running setup.py bdist_wheel for optunity: finished with status 'done'
  Stored in directory: /root/.cache/pip/wheels/1c/a1/79/8c2f85ed743981107a5b98afcc95bab74d5f85335ec70c7995
  Running setup.py bdist_wheel for scikit-learn: started
  Running setup.py bdist_wheel for scikit-learn: finished with status 'error'
  Complete output from command /usr/local/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-jprwp998/scikit-learn/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/pip-wheel-mhy2zrpk --python-tag cp36:
  Partial import of sklearn during the build process.
  Traceback (most recent call last):
    File "/tmp/pip-install-jprwp998/scikit-learn/setup.py", line 168, in get_numpy_status
      import numpy
  ModuleNotFoundError: No module named 'numpy'
  Traceback (most recent call last):
    File "/tmp/pip-install-jprwp998/scikit-learn/setup.py", line 148, in get_scipy_status
      import scipy
  ModuleNotFoundError: No module named 'scipy'
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-jprwp998/scikit-learn/setup.py", line 269, in <module>
      setup_package()
    File "/tmp/pip-install-jprwp998/scikit-learn/setup.py", line 249, in setup_package
      .format(numpy_req_str, instructions))
  ImportError: Numerical Python (NumPy) is not installed.
  scikit-learn requires NumPy >= 1.8.2.
  Installation instructions are available on the scikit-learn website: http://scikit-learn.org/stable/install.html


  ----------------------------------------
  Failed building wheel for scikit-learn
  Running setup.py clean for scikit-learn

и файл докера, который я использую для сборки, это

# Dockerfile for Python whisk docker action
FROM openwhisk/dockerskeleton

ENV FLASK_PROXY_PORT 8080


# lapack-dev is available in community repo.
RUN echo "http://dl-4.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories

# add package build dependencies
RUN apk add --no-cache \
        g++ \
        lapack-dev \
        gfortran


# Install our action's Python dependencies
ADD requirements.txt /action/requirements.txt
RUN cd /action; pip install -r requirements.txt

# Add all source assets
ADD . /action
# Rename our executable Python action

ADD main.py /action/exec


CMD ["/bin/bash", "-c", "cd actionProxy && python -u actionproxy.py"]

файл требований

numpy==1.14.3
elm
scipy
sklearn

Я искал много сайтов, но ничего не помогало, если у кого-то есть идеи или опыт работы с openwhisk docker python, пожалуйста, любая помощь будет признательна.

Я проверил его, просто установив numpy, и он отлично работает, но каким-то образом, когда я добавляю scipy и numpy для установки, я получаю сообщение об ошибке, что модуль numpy не найден.

Спасибо

1 Ответ

0 голосов
/ 05 сентября 2018

Попробуйте использовать вид среды исполнения Python python-jessie:3, он уже содержит некоторые относящиеся к ML пакеты, такие как numpy, scipy, pandas и scikit-learn

Например, используя CLI для создания действия

ibmcloud fn action update mymlaction mymlaction.py --kind python-jessie:3

Подробнее о времени выполнения Python здесь https://console.bluemix.net/docs/openwhisk/openwhisk_reference.html#openwhisk_ref_python_environments

...