How to fix error :" AttributeError: module 'tensorflow' has no attribute 'contrib' " on Windows

14,902

This Error occurs because tf.contrib is removed from TensorFlow 2. I guess you are using old code from Tensorflow 1 that is not compatible with the new Tenserflow 2. For more information checkout Migrate your TensorFlow 1 code to TensorFlow 2. If you need more help please share all code snippets where you use tf.contrib.

Share:
14,902

Related videos on Youtube

Hồ Huy
Author by

Hồ Huy

Updated on June 04, 2022

Comments

  • Hồ Huy
    Hồ Huy over 1 year

    I have a source code read CAPTCHA. When i run test, I got a problem on Windows 10

    Traceback (most recent call last):
      File "train.py", line 48, in <module>
        from object_detection.builders import dataset_builder
      File "C:\Users\HuyHys\Anaconda3\lib\site-packages\object_detection\builders\dataset_builder.py", line 27, in <module>
        from object_detection.data_decoders import tf_example_decoder
      File "C:\Users\HuyHys\Anaconda3\lib\site-packages\object_detection\data_decoders\tf_example_decoder.py", line 27, in <module>
        slim_example_decoder = tf.contrib.slim.tfexample_decoder
    AttributeError: module 'tensorflow' has no attribute 'contrib'
    

    I found a ask on stackoverflow (visit Module 'tensorflow' has no attribute 'contrib')

    But i can't fix this error. Pls, anyone can help me! How to fix detail this error???

    • Denis Rasulev
      Denis Rasulev about 4 years
      In your link to the other answer there are several good solutions to try. What exactly is your problem? What have you tried and it didn't work?
    • Hồ Huy
      Hồ Huy about 4 years
      i got error when i'm setting environment
    • Hồ Huy
      Hồ Huy about 4 years
      I got this error with only windows. On ubuntu, i got other errors