我有以下内容Dockerfile
:
ARG TF_VERSION
FROM tensorflow/tensorflow:${TF_VERSION}-gpu-jupyter AS base
COPY requirements.in /opt/app/requirements.in
WORKDIR /opt/app
RUN python -m pip install pip-tools && \
pip-compile requirements.in && \
python -m pip install -r requirements.txt
以及以下内容requirements.in
:
tensorflow-addons
tensorflow-data-validation
tensorflow-datasets
tensorflow-hub
tensorflow-metadata
tensorflow-model-analysis
tensorflow-model-optimization
tensorflow-probability
tensorflow-serving-api
tensorflow-transform
tensorflow_hub
这个想法是能够使用 tensorflow 版本作为参数来构建 Docker 映像,例如:
docker build -t demo . --build-arg TF_VERSION=2.7.0
并pip-compile
找出与 Docker 镜像附带的 tensorflow 版本兼容的附加 tensorflow 模块的版本。
但这失败了:
Could not find a version that matches tensorflow!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,<2.7,<3,>=1.15.2,>=2.7.0 (from tensorflow-transform==1.3.0->-r requirements.in (line 10))
Tried: 0.12.1, 1.0.0, 1.0.1, 1.1.0, 1.2.0, 1.2.1, 1.3.0, 1.4.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.7.0, 1.7.1, 1.8.0, 1.9.0, 1.10.0, 1.10.1, 1.11.0, 1.12.0, 1.12.2, 1.12.3, 1.13.1, 1.13.2, 1.14.0, 1.15.0, 1.15.2, 1.15.3, 1.15.4, 1.15.5, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.0.4, 2.1.0, 2.1.1, 2.1.2, 2.1.3, 2.1.4, 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.6.0, 2.6.1, 2.6.2
Skipped pre-versions: 2.2.0rc0, 2.2.0rc1, 2.2.0rc2, 2.2.0rc3, 2.2.0rc4, 2.3.0rc0, 2.3.0rc1, 2.3.0rc2, 2.4.0rc0, 2.4.0rc1, 2.4.0rc2, 2.4.0rc3, 2.4.0rc4, 2.5.0rc0, 2.5.0rc1, 2.5.0rc2, 2.5.0rc3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2
There are incompatible versions in the resolved dependencies:
tensorflow!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,<3,>=1.15.2 (from tensorflow-model-analysis==0.34.1->-r requirements.in (line 6))
tensorflow<3,>=2.7.0 (from tensorflow-serving-api==2.7.0->-r requirements.in (line 9))
tensorflow!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,<2.7,>=1.15.2 (from tensorflow-transform==1.3.0->-r requirements.in (line 10))
tensorflow!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.*,!=2.4.*,!=2.5.*,<3,>=1.15.2 (from tensorflow-data-validation==1.3.0->-r requirements.in (line 2))
如何在不手动在requirements.in
文件中添加版本限制的情况下解决此问题?