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).
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?
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
In the docker image this would look like this:
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With