io icon indicating copy to clipboard operation
io copied to clipboard

versions >0.31.0 do not work with TensorFlow versions > 2.10.0 using poetry

Open vasilogi opened this issue 2 years ago • 2 comments

Every time I get to install TensorFlow on a poetry environment, I need to also install it along with tensorflow-io-gcs-filesystem. However, version of TensorFlow higher than 2.10.0 are not compatible with version of tensorflow-io-gcs-filesystem higher than 0.31.0 in a poetry environment. As an example below, I have installed TensorFlow 2.14.0 and when I try to update to tensorflow-io-gcs-filesystem==0.32.0 I get the following error:

Updating dependencies
Resolving dependencies... (0.4s)

Package operations: 0 installs, 1 update, 0 removals

  ò Updating tensorflow-io-gcs-filesystem (0.31.0 -> 0.32.0): Failed

  RuntimeError

  Unable to find installation candidates for tensorflow-io-gcs-filesystem (0.32.0)

  at C:\Python311\Lib\site-packages\poetry\installation\chooser.py:73 in choose_for
       69|
       70|             links.append(link)
       71|
       72|         if not links:
    >  73|             raise RuntimeError(f"Unable to find installation candidates for {package}")
       74|
       75|         # Get the best link
       76|         chosen = max(links, key=lambda link: self._sort_key(package, link))
       77|

vasilogi avatar Oct 25 '23 08:10 vasilogi

Welcome to the club 🙈 This issue has been discussed here and here.

RRiva avatar Oct 31 '23 09:10 RRiva

Not sure if someone is going to read it, but I've managed to "fix" this one by forcing to use tensorflow v2.13 instead of the latest one (at this moment it's v2.15).

Environment I test:

  • python 3.10.13
  • Macbook M2 Max
  • poetry 1.7.1

And this is what I have added in the toml file:

tensorflow = {version = "2.13.0" }
tensorflow-macos = { version = "2.13.0", platform = "darwin", markers = "platform_machine=='arm64'" }
tensorflow-intel = { version = "2.13.0", platform = "win32" }
tensorflow-cpu = [
    { version = "2.13.0", platform = "linux", markers = "platform_machine!='arm64' and platform_machine!='aarch64'" },
    { version = "2.13.0", platform = "darwin", markers = "platform_machine!='arm64' and platform_machine!='aarch64'" },
]
tensorflow-cpu-aws = { version = "2.13.0", platform = "linux", markers = "platform_machine=='arm64' or platform_machine=='aarch64'" }
# https://github.com/tensorflow/tensorflow/blob/adb39b04e9cb116df4659a7e2de9eea27e62f25c/tensorflow/tools/pip_package/setup.py#L107-L108
# https://github.com/python-poetry/poetry/issues/8271#issuecomment-1697740447
tensorflow-io-gcs-filesystem = [
    { version = ">= 0.23.1", markers = "platform_machine!='arm64' or platform_system!='Darwin'" },
    { version = "< 0.32.0", markers = "platform_system == 'Windows'" }
]

defudef avatar Dec 25 '23 19:12 defudef