【问题标题】:Let pip-compile determine versions of tensorflow packages based on installed tensorflow version让 pip-compile 根据安装的 tensorflow 版本确定 tensorflow 包的版本
【发布时间】:2021-12-28 15:48:08
【问题描述】:

我有以下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 文件中不手动添加版本限制的情况下解决此问题?

【问题讨论】:

    标签: docker tensorflow pip pip-tools


    【解决方案1】:

    新的解析器即将推出#1539,应该可以解决问题。

    【讨论】:

      猜你喜欢
      • 2019-09-16
      • 1970-01-01
      • 2019-06-20
      • 1970-01-01
      • 1970-01-01
      • 2020-04-26
      • 2021-02-13
      • 2021-07-04
      • 2018-01-07
      相关资源
      最近更新 更多