Tensorflow:泊坞窗映像和-gpu后缀 [英] Tensorflow: docker image and -gpu suffix
问题描述
在具有GPU支持的Tensorflow的Docker映像中(例如: tensorflow / tensorflow:2.2.0-gpu
),已安装的python软件包为 tensorflow-gpu
(如 pip冻结
中所示)。
In the Docker image for Tensorflow with GPU support (for example: tensorflow/tensorflow:2.2.0-gpu
) the installed python package is tensorflow-gpu
(as shown in pip freeze
).
安装任何依赖 tensorflow
的python软件包都会触发tensorflow本身的安装,尽管它已经安装在其他版本下名称(因为-正确- tensorflow-gpu
!= tensorflow
)。
Installing any python package that depends on tensorflow
triggers the installation of tensorflow itself, although it's already installed under a different name (because -- correctly -- tensorflow-gpu
!= tensorflow
).
有办法避免这种情况吗?
Is there a way to avoid this?
推荐答案
您可以添加一条指令以安装伪造的 tensorflow
软件包,该软件包仅写入元数据而不添加重复的源:
You can add an instruction to install a fake tensorflow
"package" that only writes the metadata without adding the duplicate sources:
$ python -c 'from setuptools import setup; setup(name="tensorflow", version="2.2.0")' install
图像如下所示:
FROM tensorflow/tensorflow:2.2.0-gpu
RUN python -c 'from setuptools import setup; setup(name="tensorflow", version="2.2.0")' install
RUN pip install my-requirements
RUN pip uninstall -y tensorflow # cleaning up
这篇关于Tensorflow:泊坞窗映像和-gpu后缀的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!