10

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.

Matthieu Brucher
  • 21,634
  • 7
  • 38
  • 62
m.mera
  • 111
  • 1
  • 1
  • 9

9 Answers9

10

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=.
Renu
  • 247
  • 3
  • 2
9

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.

Diwakar Patel
  • 91
  • 1
  • 3
3

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.

Kumar S
  • 399
  • 4
  • 9
3

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

Maryam Bahrami
  • 1,056
  • 9
  • 18
2

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)

Prathamesh Bhatkar
  • 291
  • 1
  • 4
  • 15
1
  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.

ron_g
  • 1,474
  • 2
  • 21
  • 39
1

My solution for windows:

  • Download protoc-3.18.0-win64.zip from here
  • Extract zip and Copy proto.exe from bin directory and paste it in models/research folder
  • Then run this command protoc object_detection/protos/*.proto --python_out=.
0

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

Derek Chow
  • 722
  • 3
  • 6
0

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.

enoted
  • 577
  • 7
  • 21
  • when I saved protobuf compiler zip folder in a path c:\program files ,it appears a text message "you don't have permission to save in this location contact the administrator to obtain permission". – m.mera Oct 22 '18 at 22:20
  • windows is 10 64 bit ,and i installed protoc-3.5.1-win32. – m.mera Oct 22 '18 at 22:29
  • try to extract your zip folder into `Program files` using the permission of an administrator – enoted Oct 22 '18 at 22:46
  • this command appears "C:\Program' is not recognized as an internal or external command, operable program or batch file." after using a permission of administrator and typing this command "C:\Program Files\protoc-protoc-3.6.1-win32\bin\protoc.exe” object_detection/protos/*.proto --python_out=." in c:\tensorflow\models\research – m.mera Oct 23 '18 at 00:14
  • did you put you path into quotational marks such like `"C:\Program Files\..."` instead of writing just `C:\Program Files\...` ? – enoted Oct 23 '18 at 07:41
  • definitely yes because the path contains a spaces . i tried 10 times – m.mera Oct 23 '18 at 09:08
  • @m.mera Did you try downloading the `protoc-3.5.1-win64` instead since you have 64-bit Windows? – ReinstateMonica3167040 May 16 '20 at 16:23