tensorflow / models

Models and examples built with TensorFlow
Other
76.92k stars 45.81k forks source link

ModuleNotFoundError: No module named 'tensorflow.compat.v1' #8932

Open khanx169 opened 4 years ago

khanx169 commented 4 years ago

Prerequisites

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

1. The entire URL of the file you are using

https://github.com/tensorflow/models/blob/master/research/object_detection/builders/model_builder_tf1_test.py

2. Describe the bug

Under the remarks on TensorFlow 1 Detection Model Zoo, it says, quote:

"Our frozen inference graphs are generated using the v1.12.0 release version of TensorFlow and we do not guarantee that these will work with other versions"

Based on that remark, I decided to install tensorflow-gpu=1.12 and then proceeded to install TF1 Object Detection API. However, when I test the installation by running:

python object_detection/builders/model_builder_tf1_test.py

I get the following error:

Traceback (most recent call last): File "object_detection/builders/model_builder_tf1_test.py", line 19, in <module> import tensorflow.compat.v1 as tf ModuleNotFoundError: No module named 'tensorflow.compat.v1'

3. Steps to reproduce

Follow the installation instructions here, with tf v1.12.0

4. Expected behavior

Shouldn't throw that error.

5. Additional context

Include any logs that would be helpful to diagnose the problem.

6. System information

syiming commented 4 years ago

Hi, could you please try using tf 1.15 and report back if there are any issues? Thanks.

khanx169 commented 4 years ago

Hi, tf >= 1.14 seems to work fine as far as I can tell (at least with the legacy scripts). However, this issue is specific to tf 1.12 and the current documentation. Thanks.

syiming commented 4 years ago

8984 Hi, I have updated the documentation. Please check the pr.

khanx169 commented 4 years ago

My hope was more along the lines of adding an explicit warning about backward incompatibility of object detection api with tf 1.12 or fixing that incompatibility.

If the backward compatibility issue can't be fixed then the documentation needs to be updated at several points, e.g. on Training and Evaluation with TensorFlow 1 page it should be explicitly required to export the pre-trained checkpoint to tf 1.15 before running the training scripts. I don't think simply removing "we do not guarantee that these will work with other versions" warning will be sufficient or as useful for new users.

XueZ-phd commented 2 years ago

I solve this issue by updating my tensorflow to 1.15.0

ftsina313 commented 1 year ago

we need to install tf-nightly to be able to work with TFP. try this : pip install tf-nightly

it worked for me

Zulfiquar15 commented 4 months ago

I solve this issue by updating my tensorflow to 1.15.0

pip install tensorflow==1.15.0 Defaulting to user installation because normal site-packages is not writeable Looking in indexes: https://pypi.org/simple, https://pypi.ngc.nvidia.com ERROR: Could not find a version that satisfies the requirement tensorflow==1.15.0 (from versions: 2.2.0, 2.2.1, 2.2.2, 2.2.3, 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.3.4, 2.4.0, 2.4.1, 2.4.2, 2.4.3, 2.4.4, 2.5.0, 2.5.1, 2.5.2, 2.5.3, 2.6.0rc0, 2.6.0rc1, 2.6.0rc2, 2.6.0, 2.6.1, 2.6.2, 2.6.3, 2.6.4, 2.6.5, 2.7.0rc0, 2.7.0rc1, 2.7.0, 2.7.1, 2.7.2, 2.7.3, 2.7.4, 2.8.0rc0, 2.8.0rc1, 2.8.0, 2.8.1, 2.8.2, 2.8.3, 2.8.4, 2.9.0rc0, 2.9.0rc1, 2.9.0rc2, 2.9.0, 2.9.1, 2.9.2, 2.9.3, 2.10.0rc0, 2.10.0rc1, 2.10.0rc2, 2.10.0rc3, 2.10.0, 2.10.1, 2.11.0rc0, 2.11.0rc1, 2.11.0rc2, 2.11.0, 2.11.1, 2.12.0rc0, 2.12.0rc1, 2.12.0, 2.12.1, 2.13.0rc0, 2.13.0rc1, 2.13.0rc2, 2.13.0, 2.13.1) ERROR: No matching distribution found for tensorflow==1.15.0