Models: AttributeError: module 'tensorflow._api.v1.compat' has no attribute 'v2'

Created on 27 Jan 2020  ·  14Comments  ·  Source: tensorflow/models

i receive the following error when following the installation steps https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md

(tensorflow_p36) ubuntu@ip-xxx-xx-xx-xx:~/tensorflow/models/research$ python object_detection/builders/model_builder_test.py

Traceback (most recent call last): File "object_detection/builders/model_builder_test.py", line 23, in <module> from object_detection.builders import model_builder File "/home/ubuntu/tensorflow/models/research/object_detection/builders/model_builder.py", line 47, in <module> from object_detection.models.ssd_mobilenet_edgetpu_feature_extractor import SSDMobileNetEdgeTPUFeatureExtractor File "/home/ubuntu/tensorflow/models/research/object_detection/models/ssd_mobilenet_edgetpu_feature_extractor.py", line 19, in <module> from object_detection.models import ssd_mobilenet_v3_feature_extractor File "/home/ubuntu/tensorflow/models/research/object_detection/models/ssd_mobilenet_v3_feature_extractor.py", line 25, in <module> from nets.mobilenet import mobilenet File "/home/ubuntu/tensorflow/models/research/slim/nets/mobilenet/mobilenet.py", line 399, in <module> def global_pool(input_tensor, pool_op=tf.compat.v2.nn.avg_pool2d): AttributeError: module 'tensorflow._api.v1.compat' has no attribute 'v2'

Most helpful comment

solved the problem by cloning the models v1.13.0

Hi Wiamadaya, I am running into the same issue. Could you please elaborate how did you solve this problem?

the tensorflow version which I'm using is 1.13.1.

hi @Aparnamaurya just download the 1.13.0 release instead https://github.com/tensorflow/models/archive/v1.13.0.zip since we are using TF 1.13

All 14 comments

solved the problem by cloning the models v1.13.0

solved the problem by cloning the models v1.13.0

Hi Wiamadaya, I am running into the same issue. Could you please elaborate how did you solve this problem?

the tensorflow version which I'm using is 1.13.1.

solved the problem by cloning the models v1.13.0

Hi Wiamadaya, I am running into the same issue. Could you please elaborate how did you solve this problem?

the tensorflow version which I'm using is 1.13.1.

hi @Aparnamaurya just download the 1.13.0 release instead https://github.com/tensorflow/models/archive/v1.13.0.zip since we are using TF 1.13

Hello @wiamadaya
ERROR: Could not find a version that satisfies the requirement tensorflow==1.13 (from versions: 0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0, 1.2.0rc0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.4.1, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.10.1, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.2, 1.12.3, 1.13.0rc0, 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0)
ERROR: No matching distribution found for tensorflow==1.13
I cant install tensorflow-1.13.0. Can you help me?

Please read PIP output it shares available versions.

tensorflow-1.13.1, 1.13.2

solved the problem by cloning the models v1.13.0

Hi Wiamadaya, I am running into the same issue. Could you please elaborate how did you solve this problem?
the tensorflow version which I'm using is 1.13.1.

hi @Aparnamaurya just download the 1.13.0 release instead https://github.com/tensorflow/models/archive/v1.13.0.zip since we are using TF 1.13

Thanks it worked by downloading the v1.13.0 version

Hello @wiamadaya
ERROR: Could not find a version that satisfies the requirement tensorflow==1.13 (from versions: 0.12.1, 1.0.0, 1.0.1, 1.1.0rc0, 1.1.0rc1, 1.1.0rc2, 1.1.0, 1.2.0rc0, 1.2.0rc1, 1.2.0rc2, 1.2.0, 1.2.1, 1.3.0rc0, 1.3.0rc1, 1.3.0rc2, 1.3.0, 1.4.0rc0, 1.4.0rc1, 1.4.0, 1.4.1, 1.5.0rc0, 1.5.0rc1, 1.5.0, 1.5.1, 1.6.0rc0, 1.6.0rc1, 1.6.0, 1.7.0rc0, 1.7.0rc1, 1.7.0, 1.7.1, 1.8.0rc0, 1.8.0rc1, 1.8.0, 1.9.0rc0, 1.9.0rc1, 1.9.0rc2, 1.9.0, 1.10.0rc0, 1.10.0rc1, 1.10.0, 1.10.1, 1.11.0rc0, 1.11.0rc1, 1.11.0rc2, 1.11.0, 1.12.0rc0, 1.12.0rc1, 1.12.0rc2, 1.12.0, 1.12.2, 1.12.3, 1.13.0rc0, 1.13.0rc1, 1.13.0rc2, 1.13.1, 1.13.2, 1.14.0rc0, 1.14.0rc1, 1.14.0, 1.15.0rc0, 1.15.0rc1, 1.15.0rc2, 1.15.0rc3, 1.15.0, 1.15.2, 2.0.0a0, 2.0.0b0, 2.0.0b1, 2.0.0rc0, 2.0.0rc1, 2.0.0rc2, 2.0.0, 2.0.1, 2.1.0rc0, 2.1.0rc1, 2.1.0rc2, 2.1.0)
ERROR: No matching distribution found for tensorflow==1.13
I cant install tensorflow-1.13.0. Can you help me?

what he means is that the model's version is 1.13.0

@DeliciousHY he is talking about the models directory not the tensorflow version. So you get tensorflow==1.13.1 installed and go to tensorflow model archives and download the 1.13.1 models folder.

Seems like a workaround rather than solution tho 🤔

Where did you place the models folder?

Where did you place the models folder?
in your tensorflow directory.
something like ..Lib/site-packages/tensorflow/

遵循安装步骤https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md时我收到以下错误

(tensorflow_p36) ubuntu@ip-xxx-xx-xx-xx:~/tensorflow/models/research$ python object_detection/builders/model_builder_test.py

Traceback (most recent call last): File "object_detection/builders/model_builder_test.py", line 23, in <module> from object_detection.builders import model_builder File "/home/ubuntu/tensorflow/models/research/object_detection/builders/model_builder.py", line 47, in <module> from object_detection.models.ssd_mobilenet_edgetpu_feature_extractor import SSDMobileNetEdgeTPUFeatureExtractor File "/home/ubuntu/tensorflow/models/research/object_detection/models/ssd_mobilenet_edgetpu_feature_extractor.py", line 19, in <module> from object_detection.models import ssd_mobilenet_v3_feature_extractor File "/home/ubuntu/tensorflow/models/research/object_detection/models/ssd_mobilenet_v3_feature_extractor.py", line 25, in <module> from nets.mobilenet import mobilenet File "/home/ubuntu/tensorflow/models/research/slim/nets/mobilenet/mobilenet.py", line 399, in <module> def global_pool(input_tensor, pool_op=tf.compat.v2.nn.avg_pool2d): AttributeError: module 'tensorflow._api.v1.compat' has no attribute 'v2'

Excuse me, how to deal with this problem?I'm consistently confused

遵循安装步骤https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md时我收到以下错误[](https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md)
(tensorflow_p36) ubuntu@ip-xxx-xx-xx-xx:~/tensorflow/models/research$ python object_detection/builders/model_builder_test.py
Traceback (most recent call last): File "object_detection/builders/model_builder_test.py", line 23, in <module> from object_detection.builders import model_builder File "/home/ubuntu/tensorflow/models/research/object_detection/builders/model_builder.py", line 47, in <module> from object_detection.models.ssd_mobilenet_edgetpu_feature_extractor import SSDMobileNetEdgeTPUFeatureExtractor File "/home/ubuntu/tensorflow/models/research/object_detection/models/ssd_mobilenet_edgetpu_feature_extractor.py", line 19, in <module> from object_detection.models import ssd_mobilenet_v3_feature_extractor File "/home/ubuntu/tensorflow/models/research/object_detection/models/ssd_mobilenet_v3_feature_extractor.py", line 25, in <module> from nets.mobilenet import mobilenet File "/home/ubuntu/tensorflow/models/research/slim/nets/mobilenet/mobilenet.py", line 399, in <module> def global_pool(input_tensor, pool_op=tf.compat.v2.nn.avg_pool2d): AttributeError: module 'tensorflow._api.v1.compat' has no attribute 'v2'

Excuse me, how to deal with this problem?I'm consistently confused

may is your tensorflow's version 's problem

遵循安装步骤https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/installation.md时我收到以下错误
(tensorflow_p36) ubuntu@ip-xxx-xx-xx-xx:~/tensorflow/models/research$ python object_detection/builders/model_builder_test.py
Traceback (most recent call last): File "object_detection/builders/model_builder_test.py", line 23, in <module> from object_detection.builders import model_builder File "/home/ubuntu/tensorflow/models/research/object_detection/builders/model_builder.py", line 47, in <module> from object_detection.models.ssd_mobilenet_edgetpu_feature_extractor import SSDMobileNetEdgeTPUFeatureExtractor File "/home/ubuntu/tensorflow/models/research/object_detection/models/ssd_mobilenet_edgetpu_feature_extractor.py", line 19, in <module> from object_detection.models import ssd_mobilenet_v3_feature_extractor File "/home/ubuntu/tensorflow/models/research/object_detection/models/ssd_mobilenet_v3_feature_extractor.py", line 25, in <module> from nets.mobilenet import mobilenet File "/home/ubuntu/tensorflow/models/research/slim/nets/mobilenet/mobilenet.py", line 399, in <module> def global_pool(input_tensor, pool_op=tf.compat.v2.nn.avg_pool2d): AttributeError: module 'tensorflow._api.v1.compat' has no attribute 'v2'

Excuse me, how to deal with this problem?I'm consistently confused

may is your tensorflow's version 's problem

I have tried many versions of tensorflow and this problem occurs:AttributeError: module 'tensorflow._api.v1.compat' has no attribute 'v2'

Was this page helpful?
0 / 5 - 0 ratings