tensorflow: Unable to run train.py / model_main.py

System information

  • Windows 10
  • TensorFlow installed via pip - I’ve tried 1.5, 1.8, 1.9, and 2.0 - all yield different error messages
  • Python 3.7.4 installed, 3.5 in virtual environment
  • Using conda too
  • CUDA/cuDNN: N/A
  • GPU model and memory: N/A, CPU only

Consistently getting error message when trying to execute train.py or model_main.py. The latter always returns “no module named pycocotools.”

The train.py error depends on the version of Tensorflow I try, but it’s always “module tensorflow has no attribute ‘[something]’” For example, ‘contrib,’ or ‘experimental’.

I’m using this command: python model_main.py --logtostderr --train_dir=training/ --pipeline_config_path=training/faster_rcnn_inception_v2_pets.config

I also tried porting the train.py to v2, with no change.

Full traceback: Traceback (most recent call last): File "train.py", line 49, in <module> from object_detection.builders import dataset_builder File "C:\tensorflow1\models\research\object_detection\builders\dataset_builder.py", line 27, in <module> from object_detection.data_decoders import tf_example_decoder File "C:\tensorflow1\models\research\object_detection\data_decoders\tf_example_decoder.py", line 32, in <module> slim_example_decoder = tf.contrib.slim.tfexample_decoder AttributeError: module 'tensorflow' has no attribute ‘contrib’``

HUGE thanks for looking at this - I’m not a professional programmer, just a hobbyist trying to get better. I appreciate the help in solving it, and I’m very open to education to help me understand the ‘why’ behind these problems!

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 2
  • Comments: 16

Most upvoted comments

Can confirm i’m getting the same problem with train.py

I’m still troubleshooting this.