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

No module named 'tensorflow_models' on Mac M2 with TF 2.13.0 #11071

Closed
plannaAlain opened this issue Aug 10, 2023 · 10 comments
Closed

No module named 'tensorflow_models' on Mac M2 with TF 2.13.0 #11071

plannaAlain opened this issue Aug 10, 2023 · 10 comments
Assignees
Labels
models:official models that come under official repository stale stat:awaiting response Waiting on input from the contributor type:bug Bug in the code

Comments

@plannaAlain
Copy link

Prerequisites

Please answer the following questions for yourself before submitting an issue.

  • [X ] I am using the latest TensorFlow Model Garden release and TensorFlow 2.
  • [X ] I am reporting the issue to the correct repository. (Model Garden official or research directory)
  • [X ] I checked to make sure that this issue has not been filed already.

1. The entire URL of the file you are using

Installed using 'pip install tf-models-official'

2. Describe the bug

I installed the latest version of tensorflow for Mac and tf-models-official (see requirements.txt below), but keep getting:

import tensorflow_models as tfm
ModuleNotFoundError: No module named 'tensorflow_models'

Code:
`import numpy as np
import tensorflow as tf
print(np.version)
print(tf.version)

import tensorflow_models as tfm

print("Top-level modules: ", dir(tfm))
print("NLP modules: ", dir(tfm.nlp))
print("Vision modules: ", dir(tfm.vision))`

3. Steps to reproduce

pip install -r requirements.txt
python test.py (see code above)

4. Expected behavior

It should find tensorflow_models

5. Additional context

tensorflow 2.13.0
tensorflow-addons 0.21.0
tensorflow-datasets 4.9.2
tensorflow-estimator 2.13.0
tensorflow-hub 0.14.0
tensorflow-macos 2.13.0
tensorflow-metadata 1.14.0
tensorflow-model-optimization 0.7.5
termcolor 2.3.0
text-unidecode 1.3
tf-models-official 2.5.1

6. System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): Mac M2 64GB
  • Mobile device name if the issue happens on a mobile device:
  • TensorFlow installed from (source or binary): pip
  • TensorFlow version (use command below): v2.13.0-rc2-7-g1cb1a030a62
  • Python version: 3.11.4
@plannaAlain plannaAlain added models:official models that come under official repository type:bug Bug in the code labels Aug 10, 2023
@laxmareddyp
Copy link
Collaborator

Hi @plannaAlain,

Thank you for getting in touch. Regrettably, TF-Text does not currently provide support for Apple Mac computers. This is the reason behind the error you're encountering. For more comprehensive information, please consult the Readme.md. This should provide you with a clearer understanding of the cause of the error you're experiencing.

Thanks.

@laxmareddyp laxmareddyp added the stat:awaiting response Waiting on input from the contributor label Aug 11, 2023
@plannaAlain
Copy link
Author

Hi @laxmareddyp,

I managed to install Text 2.13 from sources but still getting same error:
tensorflow 2.13.0
tensorflow-addons 0.21.0
tensorflow-datasets 4.9.2
tensorflow-estimator 2.13.0
tensorflow-hub 0.14.0
tensorflow-macos 2.13.0
tensorflow-metadata 1.14.0
tensorflow-model-optimization 0.7.5
tensorflow-text 2.13.0

import tensorflow_models as tfm

ModuleNotFoundError: No module named 'tensorflow_models'

@google-ml-butler google-ml-butler bot removed the stat:awaiting response Waiting on input from the contributor label Aug 15, 2023
@laxmareddyp
Copy link
Collaborator

Hi @plannaAlain ,

I'm pleased to know that you were able to successfully install TensorFlow Text version 2.13.0. However, there seems to be an issue with the compatibility between TensorFlow Text and the official TensorFlow models (tf-models-official). The requirement.txt file of tf-models-official expects a matching version of TensorFlow Text, which can lead to problems. To address this, you should install the same version of TensorFlow Text as specified in the requirement.txt of tf-models-official(2.13.0). This will likely resolve the error you encountered. Also, it's worth noting that you don't need to install TensorFlow separately when installing tf-models-official, as it should be automatically included as a dependency.

Use below command for installing tf-models-official 2.13.0:

!pip install tf-models-official==2.13.0

Thanks.

@laxmareddyp laxmareddyp added the stat:awaiting response Waiting on input from the contributor label Aug 15, 2023
@github-actions
Copy link

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale label Aug 23, 2023
@plannaAlain
Copy link
Author

pip install tf-models-official==2.13.0 yields:
Using cached tensorflow_model_optimization-0.7.5-py2.py3-none-any.whl.metadata (914 bytes)
INFO: pip is looking at multiple versions of tf-models-official to determine which version is compatible with other requirements. This could take a while.
ERROR: Could not find a version that satisfies the requirement tensorflow-text~=2.13.0 (from tf-models-official) (from versions: none)
ERROR: No matching distribution found for tensorflow-text~=2.13.0

Here's my setup:
tensorboard-data-server 0.7.1
tensorflow 2.13.0
tensorflow-estimator 2.13.0
tensorflow-macos 2.13.0

@google-ml-butler google-ml-butler bot removed stale stat:awaiting response Waiting on input from the contributor labels Aug 24, 2023
@laxmareddyp
Copy link
Collaborator

Hi @plannaAlain,

TF-Text does not currently provide support for Apple Mac computers. This is the reason behind the error you're encountering even though you managed to install TF-text.

Thanks.

@laxmareddyp laxmareddyp added the stat:awaiting response Waiting on input from the contributor label Aug 28, 2023
@github-actions
Copy link

github-actions bot commented Sep 5, 2023

This issue has been marked stale because it has no recent activity since 7 days. It will be closed if no further activity occurs. Thank you.

@github-actions github-actions bot added the stale label Sep 5, 2023
@github-actions
Copy link

This issue was closed due to lack of activity after being marked stale for past 7 days.

@google-ml-butler
Copy link

Are you satisfied with the resolution of your issue?
Yes
No

@laxmareddyp
Copy link
Collaborator

Hi,

we have created a separate pip package for TensorFlow Official Models (tf-models-no-deps 2.16.0) this won't have TensorFlow Text (TF-Text) as a dependency. This will allow users to install and use tf-models-official(for vision users) on any platform without needing TF-Text specifically.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
models:official models that come under official repository stale stat:awaiting response Waiting on input from the contributor type:bug Bug in the code
Projects
None yet
Development

No branches or pull requests

2 participants