简体   繁体   English

DockerSkeleton python ML模块安装错误

[英]DockerSkeleton python ML module installation error

I am trying to install python ml modules via dockerSkeleton so i can invoke docker action from openwhisk cli but i am keep getting below errors and couldn't find much help. 我正在尝试通过dockerSkeleton安装python ml模块,以便我可以从openwhisk cli调用docker action,但是我一直在遇到错误,并且找不到太多帮助。

  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

and the docker file i am using to build this is 而我用来构建的docker文件是

# 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"]

requirement file is 需求文件是

numpy==1.14.3
elm
scipy
sklearn

i have searched alot of websites but nothing is helping, if anyone have any idea or experience with openwhisk docker python actions please any help would be appreciated. 我已经搜索了很多网站,但没有任何帮助,如果有人对openwhisk docker python操作有任何想法或经验,请提供任何帮助。

I have checked it by just installing numpy and its working perfectly but somehow when i add scipy and numpy both to install it throws me error that numpy module not found. 我已经通过仅安装numpy进行了检查,它工作正常,但是以某种方式在我同时添加scipy和numpy时都安装了它,这引发了我找不到numpy模块的错误。

Thanks 谢谢

Try using the python runtime kind python-jessie:3 it already contains some ML related packages like numpy, scipy, pandas, and scikit-learn 尝试使用python运行时类型python-jessie:3它已经包含一些与ML相关的软件包,例如numpy,scipy,pandas和scikit-learn

For example using the CLI to create an action 例如,使用CLI创建动作

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

More details on the python runtime here https://console.bluemix.net/docs/openwhisk/openwhisk_reference.html#openwhisk_ref_python_environments 有关python运行时的更多详细信息,请参见https://console.bluemix.net/docs/openwhisk/openwhisk_reference.html#openwhisk_ref_python_environments

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM