我正在尝试通过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
和我用来构建它的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"]
需求文件是
numpy==1.14.3
elm
scipy
sklearn
我已经搜索了很多网站,但没有任何帮助,如果有人对openwhisk docker python操作有任何想法或经验,请提供任何帮助。
我已经通过仅安装numpy进行了检查,它可以正常工作,但是以某种方式在我同时添加scipy和numpy时都安装了它,这引发了我找不到numpy模块的错误。
谢谢
答案 0 :(得分:0)
尝试使用python运行时类型python-jessie:3
,它已经包含一些与ML相关的软件包,例如numpy,scipy,pandas和scikit-learn
例如,使用CLI创建动作
ibmcloud fn action update mymlaction mymlaction.py --kind python-jessie:3
有关python运行时的更多详细信息