Installing Tensorflow and object detection errors -**ImportError: cannot import name 'builder' from 'google.protobuf.internal'

Full disclosure, python etc is not my strong point i’m learning and following tutorials, however the ease at which all of these fail is frustrating. I am following the tutorials and then something breaks or doesnt work and then spend hours trying to fix it only for something else to break !

I am following the tutorial here: Installation — TensorFlow 2 Object Detection API tutorial documentation

Ill list my commands step by step in the hope some one can tell me what im doing wrong

conda create -n tensorflow pip python=3.9

conda activate tensorflow

pip install --ignore-installed --upgrade tensorflow==2.5.0

python -c “import tensorflow as tf;print(tf.reduce_sum(tf.random.normal([1000, 1000])))”

protoc object_detection/protos/*.proto --python_out=.

(no output is shown or errors)

pip install cython

pip install git+

cp object_detection/packages/tf2/ .

python -m pip install .

python object_detection/builders/

Traceback (most recent call last):

File “C:\tensorflow\models\research\object_detection\builders\”, line 24, in

from import model_builder

File “C:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\object_detection\builders\”, line 23, in

from import anchor_generator_builder

File “C:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\object_detection\builders\”, line 26, in

from object_detection.protos import anchor_generator_pb2

File “C:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\object_detection\protos\”, line 5, in

from google.protobuf.internal import builder as _builder

ImportError: cannot import name ‘builder’ from ‘google.protobuf.internal’ (C:\ProgramData\Anaconda3\envs\tensorflow\lib\site-packages\google\protobuf\

1 Like

Hi @Alistair_Phillips, I have run the above commands in wsl environment with Tensorflow 2.15 and did not face any error.

Thank You.

Could it be working because you’re using Linux? Because it doesn’t work properly on windows @Kiran_Sai_Ramineni