在我的坞构建过程中,我一直看到一条错误消息,在这个部分,docker试图安装我的requirements.txt文件,上面写着Module Not Found。然而,它说找不到的模块的一半时间都在可用版本列表中。
我一直在尝试旧的版本,最终我会找到一个可以工作的版本,但是在下一个包中也会出现同样的情况。试着建造一个肯定不对的容器需要几个小时。我假设这可能与包可能没有在容器的不同层之间传递有关,但我对Docker并不熟悉,因此无法判断这是否是问题所在,或者如何修复它。
我使用WSL2 (Ubuntu20.04)在Python中构建一个烧瓶应用程序(从技术上讲,它是一个Plotly应用程序,但我读到它的工作原理与烧瓶一样)。我有一台Windows 10机器,我确保Docker与WSL2和Ubuntu兼容。我已经粘贴了下面遇到的许多错误中的几个,以及当前的requirements.txt、Dockerfile和文件结构。
我想知道如何防止这条信息不断出现,以及如何知道哪个包与Docker兼容?任何帮助都将不胜感激。
我看到的一些错误消息是:
ERROR: Could not find a version that satisfies the requirement pandas==1.0.5 (from versions: 0.1, 0.2, 0.3.0, 0.4.0,
0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0, 0.10.1,
0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0, 0.17.1,
0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23.0, 0.23.1,
0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0, 1.0.1, 1.0.2, 1.0.3,
1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5)
#12 50.80 ERROR: No matching distribution found for pandas==1.0.5或者:
#12 17.32 ERROR: Could not find a version that satisfies the requirement pandas==1.3.3 (from versions: 0.1, 0.2, 0.3.0,
0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.5.0, 0.6.0, 0.6.1, 0.7.0, 0.7.1, 0.7.2, 0.7.3, 0.8.0, 0.8.1, 0.9.0, 0.9.1, 0.10.0,
0.10.1, 0.11.0, 0.12.0, 0.13.0, 0.13.1, 0.14.0, 0.14.1, 0.15.0, 0.15.1, 0.15.2, 0.16.0, 0.16.1, 0.16.2, 0.17.0,
0.17.1, 0.18.0, 0.18.1, 0.19.0, 0.19.1, 0.19.2, 0.20.0, 0.20.1, 0.20.2, 0.20.3, 0.21.0, 0.21.1, 0.22.0, 0.23.0,
0.23.1, 0.23.2, 0.23.3, 0.23.4, 0.24.0, 0.24.1, 0.24.2, 0.25.0, 0.25.1, 0.25.2, 0.25.3, 1.0.0, 1.0.1, 1.0.2, 1.0.3,
1.0.4, 1.0.5, 1.1.0, 1.1.1, 1.1.2, 1.1.3, 1.1.4, 1.1.5)或者:
#12 108.3 ERROR: Could not find a version that satisfies the requirement numpy==1.18.5 (from versions: 1.3.0, 1.4.1,
1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2,
1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0rc1, 1.13.0rc2, 1.13.0, 1.13.1, 1.13.3,
1.14.0rc1, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0rc1, 1.15.0rc2, 1.15.0, 1.15.1, 1.15.2, 1.15.3,
1.15.4, 1.16.0rc1, 1.16.0rc2, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0rc1, 1.17.0rc2, 1.17.0,
1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0rc1, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0rc1,
1.19.0rc2, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5)
#12 108.3 ERROR: No matching distribution found for numpy==1.18.5在回滚一些包之后,当前的requirements.txt仍然没有找到一些模块:
Brotli==1.0.9
dash==2.0.0
dash-bootstrap-components==0.13.1
dash-core-components==2.0.0
dash-html-components==2.0.0
dash-table==5.0.0
Flask==2.0.1
Flask-Compress==1.10.1
itsdangerous==2.0.1
Jinja2==3.0.2
MarkupSafe==1.1.1
numpy==1.17.2
pandas==1.0.5
plotly==5.3.1
python-dateutil==2.8.2
pytz==2021.3
six==1.16.0
tenacity==8.0.1
Werkzeug==2.0.2Dockerfile:
ARG APP_IMAGE=python:3.6.1-alpine
FROM $APP_IMAGE AS base
FROM base as builder
##test these out
RUN mkdir /install
WORKDIR /install
COPY requirements.txt /requirements.txt
# RUN pip install flask==2.0.0 ###I've tried running pip install of the packages here, which worked but I still kept hitting the same error for each package
# RUN pip install MarkupSafe==2.0.1
RUN pip install --upgrade pip
RUN python3 -m pip install -r /requirements.txt
FROM base
ENV FLASK_APP index.py
WORKDIR /project
COPY --from=builder /install /usr/local
ADD . /project
ENTRYPOINT ["python3", "flask", "run", "--host=0.0.0.0"]档案结构:
-apps
-main.py
-assets
-env
-app.py
-data.csv
-Dockerfile
-index.py #entry point to the application
-requirements.txt发布于 2021-10-20 12:49:07
尝试使用另一个python实例(这是python版本问题,python 3.6与此要求不兼容)
我认为python3.8将满足这一要求
发布于 2021-10-20 13:16:28
阿尔卑斯版本的Docker映像是您试图使用的软件中最紧凑的映像。这是一个Docker映像,它没有包所依赖的几个Linux库和模块。
如果您担心您的Docker映像的大小,并且需要遵循存储要求,请尝试使用Python映像。它比标准版本要小,但包含了阿尔卑斯不具备的几个依赖项。
https://stackoverflow.com/questions/69643879
复制相似问题