Skip to content

List TensorFlow as an "extra" requirement to install the correct TFA for a given TF version #2111

Closed
@tgaddair

Description

When installing tensorflow_addons without specifying an exact version, users may install a version that is incompatible with their existing TensorFlow version.

As such, users are advised to check the Python Op Compatibility Matrix and manually install the correct version of TFA to be safe.

For most Python projects, this can be taken care of automatically by listing a specific tensorflow version(s) as a requirement in the setup.py file:

install_requires=['tensorflow>=2.2,<2.4']

I suspect that this project does not do this because of the various different pip package names TensorFlow uses (e.g., tf-nightly, tensorflow-gpu, tensorflow-cpu). By having such a requirement, user could accidentally install two different versions of TensorFlow at the same time.

To get around this, we could introduce an extra requirement:

extras_require = {'tensorflow': ['tensorflow>=2.2,<2.4']}

This way, users will only get automatic dependency resolution when running pip install tensorflow_addons[tensorflow].

The benefit of doing this is that if a new version of TFA is released that no longer supports TensorFlow 2.2 (for example), pip will fall back to installing the previous version of TFA if the user has TF 2.2 installed.

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions