9
votes

When I run this:

protoc --python_out=. .\object_detection\protos\anchor_generator.proto

on a tensorflow object detection file on the command line, I get:

'protoc' is not recognized as an internal or external command, operable program or batch file.

I followed all instructions in protoc object_detection/protos/*.proto: No such file or directory, but they never worked for me

In addition to the searches I made, I tried this command:

py-3.6 -m pip install protobuf

and it works for me.

I typed the command again

python_out=. .\object_detection\protos\anchor_generator.proto 

But it still fails and this:

C:\Users\laptop market\Downloads\bin\protoc object_detection/protos/*.proto --py_out=.

also fails.

8
Change title and reformat text. - Matthieu Brucher
protoc is a separate program that drives compiling protobuf files in all languages. You can get it here: github.com/protocolbuffers/protobuf - Steve Severance
Possible duplicate of Protobuf Compilation Issues - LeKhan9

8 Answers

9
votes

You need to save the protoc.exe file which is located in the zip file to C:\Users\Satyarth\AppData\Local\Programs\Python\Python36\Scripts.

Replace "Satyarth" from the path with your username.

If it still isn't working, put the above path in the environment variables.

5
votes

The way I solved the issue on Windows 10 was to

  1. copy the protoc file https://github.com/protocolbuffers/protobuf/releases/download/v3.12.4/protoc-3.12.4-win64.zip from the link https://github.com/protocolbuffers/protobuf/releases
  2. Extract the contents of the zip file.
  3. Bin directory contains the protoc.exe
  4. Update the environment variable to point to the bin directory that contains the protoc.exe
  5. Re-Open the cmd as the environment variable take effect only on new command window
  6. run protoc object_detection/protos/*.proto --python_out=.
3
votes

Go to this page to find the downloadable files for the latest version of Protobuf: https://www.github.com/google/protobuf/releases/latest

Then, just download the zip file beginning with protoc for your OS.

Next, extract it, and you will get a protoc application.

Finally, you can place it on your local machine.

2
votes

First, make sure that you have protobuf >=3 installed on your system.

On Windos protobuf is usually installed through your Python package manager, e.g. conda or pip, and should already be in your environment. You can check if it is installed with either conda list or pip freeze.

If it is not installed, simply run

conda install protobuf or pip install protobuf

1
votes
  1. when you download the .zip from https://github.com/protocolbuffers/protobuf/releases, make sure you're getting the correct file for your OS.
  2. for Windows, in environment variables, you need to add the folder that contains protoc.exe, so in my case C:\Program Files\GoogleProtobuf\bin

That got it working for me.

1
votes

I also encountered this error a while ago To go around this: Follow the steps listed below:

  1. Install the protoc which is applicable for your operating system from this github repo for me it was
    protoc-3.13.0-win64.zip

  2. Extract the zip file and put it in a folder where it will be permanently there

  3. Go to the bin folder present in the protocFolder in my case I had to go to
    F:\Programing_stuff\ML\protoc-3.17.3-win64\bin or just find where the protoc.exe file is and copy the path

  4. Then in the windows search bar type path and click on Edit the system environment variables

  5. And the path of the bin folder

Hope this helps, If doesn't check this video Or this website (If you want to install TensorFlow)

0
votes

Depending on your platform, you might have to install protobuf locally. See the docs for more detailed instructions.

0
votes

First of all consider installing Protobuf Compiler inside the C:\Program Files folder. Then you need to compile protobuf every time you want to use Tensorflow Object Detection API. To do this, open cmd in the ../models/research directory and run

“C:\Program Files\protoc-<PROTO_VERSION>\bin\protoc.exe” object_detection/protos/*.proto --python_out=.

where <PROTO_VERSION> is the version of protobuf compiler, you're using (for example protoc-3.5.1-win64 or the name of the folder you've picked for the protobuf).

Be advised, that you should compile protobuf in the every cmd window that is launched to work with Object Detection.