Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tensorflow 2.13.0 cannot be imported after install via poetry due to missing wheel metadata #61477

Open
dre-hh opened this issue Aug 4, 2023 · 6 comments
Assignees
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower subtype:macOS macOS Build/Installation issues TF 2.13 For issues related to Tensorflow 2.13 type:bug Bug type:build/install Build and install issues

Comments

@dre-hh
Copy link

dre-hh commented Aug 4, 2023

Issue type

Bug

Have you reproduced the bug with TensorFlow Nightly?

No

Source

binary

TensorFlow version

2.13.0

Custom code

No

OS platform and distribution

macOS-13.3-arm64-arm-64bit

Mobile device

No response

Python version

3.11

Bazel version

No response

GCC/compiler version

No response

CUDA/cuDNN version

No response

GPU model and memory

No response

Current behavior?

After installing tensorflow 2.13.0 with poetry it cannot be imported

Standalone code to reproduce the issue

See python-poetry/poetry#8271

According to @dimbleby, the issue happens due to missing wheel metadata.

please encourage the tensorflow folk to publish consistent metadata in all of their wheels, with platform-specific variations described by markers

Tensorflow folks, please publish consistent metadata ;)

poetry add tensorflow==2.13.0
poetry shell
python3 
import tensorflow

Relevant log output

ModuleNotFoundError: No module named 'tensorflow
@google-ml-butler google-ml-butler bot added the type:bug Bug label Aug 4, 2023
@Varsha-anjanappa Varsha-anjanappa added TF 2.13 For issues related to Tensorflow 2.13 subtype:macOS macOS Build/Installation issues type:build/install Build and install issues labels Aug 11, 2023
@Varsha-anjanappa
Copy link

Hi @dre-hh ,

As you can see this issue. Yes tensorflow's metadata does not express tensorflow-macos dependency. As a workaround you can explicitly add tensorflow-macos which solves the issue -
poetry add tensorflow-macos==2.13.0

Thank you!!

@Varsha-anjanappa Varsha-anjanappa added the stat:awaiting response Status - Awaiting response from author label Aug 11, 2023
@win845
Copy link

win845 commented Aug 12, 2023

Thx for reply. Unfortunately this is not a good workaround. People nowadays develop on arm macs and deploy on x86. That means , one cannot produce a lockfile for the whole team to install same package versions cross platform . It is a problem which is hard to solve in python but poetry addresses quite well.

There is also another problem:

If you check the Metadata inside the pip site_packages. On arm linux tensorflow
also installs a different package ( tensorflow aws). This dependency is also not expressed on pypa json Metadata . I suppose poetry is only using that, and will install wrong packages on linux arm as well.

Could you please publish consistent Metadata to pypa in same way it is expressed in Metadata file when the package is downloaded

@github-actions
Copy link

This issue is stale because it has been open for 7 days with no activity. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale This label marks the issue/pr stale - to be closed automatically if no activity label Aug 20, 2023
@dre-hh
Copy link
Author

dre-hh commented Aug 24, 2023

@Varsha-anjanappa any update on the idea adding same dependencies to pypi metadata as in the pip package?
Is this maybe tracked on another issue?
Is there a reason which prevents tensorflow team from doing this?
Without this metadata , the user of the package has to figure out himself which platform specific packages to install

@google-ml-butler google-ml-butler bot removed stale This label marks the issue/pr stale - to be closed automatically if no activity stat:awaiting response Status - Awaiting response from author labels Aug 24, 2023
@sachinprasadhs
Copy link
Contributor

@kulinseth , Is it something to do with Tensorflow MacOS release?

@sachinprasadhs sachinprasadhs added the stat:awaiting tensorflower Status - Awaiting response from tensorflower label Aug 24, 2023
@dre-hh
Copy link
Author

dre-hh commented Aug 25, 2023

@sachinprasadhs, no it is the tensorflow package itself.

cd  python-3.11/lib/python3.11/site-packages/tensorflow-2.13.0.dist-info
cat METADATA

=>
Description-Content-Type: text/markdown
Requires-Dist: tensorflow-macos (==2.13.0) ; platform_system == "Darwin" and platform_machine == "arm64"
Requires-Dist: tensorflow-cpu-aws (==2.13.0) ; platform_system == "Linux" and (platform_machine == "arm64" or platform_machine == "aarch64")
Requires-Dist: tensorflow-intel (==2.13.0) ; platform_system == "Windows"

This metadata was not published to pypi

$ curl -s https://pypi.org/pypi/tensorflow/2.13.0/json | jq '.info.requires_dist'
[
  "absl-py (>=1.0.0)",
  "astunparse (>=1.6.0)",
  "flatbuffers (>=23.1.21)",
  "gast (<=0.4.0,>=0.2.1)",
  "google-pasta (>=0.1.1)",
  "h5py (>=2.9.0)",
  "libclang (>=13.0.0)",
  "numpy (<=1.24.3,>=1.22)",
  "opt-einsum (>=2.3.2)",
  "packaging",
  "protobuf (!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3)",
  "setuptools",
  "six (>=1.12.0)",
  "termcolor (>=1.1.0)",
  "typing-extensions (<4.6.0,>=3.6.6)",
  "wrapt (>=1.11.0)",
  "grpcio (<2.0,>=1.24.3)",
  "tensorboard (<2.14,>=2.13)",
  "tensorflow-estimator (<2.14,>=2.13.0)",
  "keras (<2.14,>=2.13.1)",
  "tensorflow-io-gcs-filesystem (>=0.23.1) ; platform_machine != \"arm64\" or platform_system != \"Darwin\""
]

Please republish a new version of the package with consitent medata as pip downloads into tensorflow-2.13.0.dist-info/METADATA file

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stat:awaiting tensorflower Status - Awaiting response from tensorflower subtype:macOS macOS Build/Installation issues TF 2.13 For issues related to Tensorflow 2.13 type:bug Bug type:build/install Build and install issues
Projects
None yet
Development

No branches or pull requests

5 participants