找不到与scipy Docker匹配的分发

djp7away  于 2022-11-09  发布在  Docker
关注(0)|答案(1)|浏览(132)

对接机

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

如何消除此错误?

mfuanj7w

mfuanj7w1#

您错过了用于安装scipyblas软件包,接下来是用于安装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

相关问题