如何解决找不到 scipy docker 的匹配发行版
码头工人
FROM python:3.8-alpine
MAINTAINER ABC
ENV PYTHONUNBUFFERED 1
copY ./requirements.txt /requirements.txt
RUN apk add gcc freetype-dev
RUN apk add gfortran musl-dev g++ libgcc libquadmath musl libgfortran
RUN apk add lapack-dev
RUN apk add libffi-dev libxslt-dev mariadb-dev build-base --virtual --no-cache && \
pip install -U cffi pip setuptools && \
pip3 install --upgrade pip --no-cache-dir wheel -r requirements.txt
RUN mkdir /code
workdir /code
copY ./code /code
在 requirements.txt 中 我写了
scipy==1.5.2
ERROR: No matching distribution found for scipy==1.5.2
ERROR: Service 'web' Failed to build: The command '/bin/sh -c apk add libffi-dev libxslt-dev mariadb-dev && pip install -U cffi pip setuptools && pip3 install --upgrade pip --no-cache-dir wheel -r requirements.txt' returned a non-zero code: 1
如何消除这个错误?
解决方法
您错过了安装 blas
的 scipy
软件包,接下来是安装 Dockerfile
的最小 scipy
,仅供参考:
Dockerfile:
FROM python:3.8-alpine
RUN apk add build-base openblas-dev && \
pip3 install numpy scipy==1.5.2
RUN python3 -c "import scipy; print(scipy.__version__)"
执行:
$ docker build -t abc:1 .
Sending build context to Docker daemon 3.584kB
Step 1/3 : FROM python:3.8-alpine
---> 5e8816ee5207
Step 2/3 : RUN apk add build-base openblas-dev && pip3 install numpy scipy==1.5.2
---> Running in d29c27cba468
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.14/community/x86_64/APKINDEX.tar.gz
(1/27) Installing libgcc (10.3.1_git20210424-r2)
(2/27) Installing libstdc++ (10.3.1_git20210424-r2)
(3/27) Installing binutils (2.35.2-r2)
(4/27) Installing libmagic (5.40-r1)
(5/27) Installing file (5.40-r1)
(6/27) Installing libgomp (10.3.1_git20210424-r2)
(7/27) Installing libatomic (10.3.1_git20210424-r2)
(8/27) Installing libgphobos (10.3.1_git20210424-r2)
(9/27) Installing gmp (6.2.1-r0)
(10/27) Installing isl22 (0.22-r0)
(11/27) Installing mpfr4 (4.1.0-r0)
(12/27) Installing mpc1 (1.2.1-r0)
(13/27) Installing gcc (10.3.1_git20210424-r2)
(14/27) Installing musl-dev (1.2.2-r3)
(15/27) Installing libc-dev (0.7.2-r3)
(16/27) Installing g++ (10.3.1_git20210424-r2)
(17/27) Installing make (4.3-r0)
(18/27) Installing fortify-headers (1.1-r1)
(19/27) Installing patch (2.7.6-r7)
(20/27) Installing build-base (0.5-r2)
(21/27) Installing libquadmath (10.3.1_git20210424-r2)
(22/27) Installing libgfortran (10.3.1_git20210424-r2)
(23/27) Installing gfortran (10.3.1_git20210424-r2)
(24/27) Installing openblas-ilp64 (0.3.15-r0)
(25/27) Installing openblas (0.3.15-r0)
(26/27) Installing pkgconf (1.7.4-r0)
(27/27) Installing openblas-dev (0.3.15-r0)
Executing busybox-1.33.1-r2.trigger
OK: 294 MiB in 62 packages
Collecting numpy
Downloading numpy-1.21.0.zip (10.3 MB)
Installing build dependencies: started
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Collecting scipy==1.5.2
Downloading scipy-1.5.2.tar.gz (25.4 MB)
Installing build dependencies: started
Installing build dependencies: still running...
Installing build dependencies: still running...
Installing build dependencies: finished with status 'done'
Getting requirements to build wheel: started
Getting requirements to build wheel: finished with status 'done'
Preparing wheel metadata: started
Preparing wheel metadata: finished with status 'done'
Building wheels for collected packages: scipy,numpy
Building wheel for scipy (PEP 517): started
Building wheel for scipy (PEP 517): still running...
Building wheel for scipy (PEP 517): still running...
Building wheel for scipy (PEP 517): still running...
Building wheel for scipy (PEP 517): still running...
Building wheel for scipy (PEP 517): still running...
Building wheel for scipy (PEP 517): still running...
Building wheel for scipy (PEP 517): still running...
Building wheel for scipy (PEP 517): still running...
Building wheel for scipy (PEP 517): still running...
Building wheel for scipy (PEP 517): finished with status 'done'
Created wheel for scipy: filename=scipy-1.5.2-cp38-cp38-linux_x86_64.whl size=26491464 sha256=6de2365eea793835cf4ca7c7323db9322cc2e37be47aaeed6e0ed860ce16fc88
Stored in directory: /root/.cache/pip/wheels/1e/97/91/6c36bcfae664855377e40cef5870fec060ed4ac1483f7f862b
Building wheel for numpy (PEP 517): started
Building wheel for numpy (PEP 517): still running...
Building wheel for numpy (PEP 517): still running...
Building wheel for numpy (PEP 517): still running...
Building wheel for numpy (PEP 517): finished with status 'done'
Created wheel for numpy: filename=numpy-1.21.0-cp38-cp38-linux_x86_64.whl size=5501003 sha256=4e40ef3fde0a6304d62dcc3221def9a40f8f2819dddbcdef1090d42eec5e60b9
Stored in directory: /root/.cache/pip/wheels/60/65/cf/1eb6d9255266eea1d6ffddce9ebc4f388bcc8460d616f17eb0
Successfully built scipy numpy
Installing collected packages: scipy,numpy
Successfully installed numpy-1.21.0 scipy-1.5.2
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
Removing intermediate container d29c27cba468
---> ac20724a1bd7
Step 3/3 : RUN python3 -c "import scipy; print(scipy.__version__)"
---> Running in b023ae576acb
1.5.2
Removing intermediate container b023ae576acb
---> 45e06522b65f
Successfully built 45e06522b65f
Successfully tagged abc:1
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。