models icon indicating copy to clipboard operation
models copied to clipboard

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

Open khanx169 opened this issue 4 years ago • 7 comments

Prerequisites

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

  • [ ] 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 already been filed.

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

  • OS Platform and Distribution (e.g., Linux Ubuntu 16.04): NAME="CentOS Linux" VERSION="7 (Core)"
  • Mobile device name if the issue happens on a mobile device: N/A
  • TensorFlow installed from (source or binary): pip
  • TensorFlow version (use command below): 1.12.0
  • Python version: 3.6.10
  • CUDA/cuDNN version: 9.1/7.0.5
  • GPU model and memory: Tesla P100

khanx169 avatar Jul 21 '20 19:07 khanx169

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

syiming avatar Jul 24 '20 00:07 syiming

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.

khanx169 avatar Jul 24 '20 03:07 khanx169

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

syiming avatar Jul 28 '20 13:07 syiming

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.

khanx169 avatar Jul 28 '20 17:07 khanx169

I solve this issue by updating my tensorflow to 1.15.0

XueZ-phd avatar Nov 17 '21 13:11 XueZ-phd

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

it worked for me

ftsina313 avatar Feb 11 '23 12:02 ftsina313

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

Zulfiquar15 avatar May 02 '24 03:05 Zulfiquar15