addons: Tensorflow-cpu is ignored when installing tensorflow-addons

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): ubuntu 18.04
  • TensorFlow version and how it was installed (source or binary): tensorflow-cpu 2.1.0
  • TensorFlow-Addons version and how it was installed (source or binary): 0.7.0
  • Python version: 3.7
  • Is GPU used? (yes/no): no

Describe the bug

In an environement where tensorflow-cpu is already installed, installing tensorflow-addons should not download and install tensorflow (now being the gpu version by default).

Code to reproduce the issue

FROM python:3.7

RUN pip install tensorflow-cpu
RUN pip install tensorflow-addons
RUN pip freeze | grep tensorflow

result:

tensorflow (gpu) is still being installed (400MB download) and the installation of tensorflow is now duplicated:

tensorflow==2.1.0
tensorflow-addons==0.7.0
tensorflow-cpu==2.1.0
tensorflow-estimator==2.1.0

A solution would be to remove the tensorflow dependency in the setup.py and let people install the version of tensorflow they want. It’s not a perfect solution but this is the best one we found, at least for keras-tuner and autokeras. (https://github.com/keras-team/keras-tuner/pull/211 and https://github.com/keras-team/autokeras/pull/860)

The problem is similar to libraries that depend on Pillow and users have already pillow-SIMD installed.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 16 (14 by maintainers)

Most upvoted comments

I’ll let you do it if you don’t mind

I’d be happy to review a PR which follows suite with TF-Graphics in requiring TF as an extra dependency (for easy test suite installs). We’ll also need to perform an import check during __init__ as described above.

An alternative is to release a tensorflow-addons-cpu package similarly to tensorflow-cpu. However, this sounds like a lot of maintenance work.

I’m fine with using the extra dependency as it gives more flexibility.