Models: object_detection/protos/*.proto: No such file or directory

Created on 30 Nov 2017  路  60Comments  路  Source: tensorflow/models

As mentioned above the error takes place in while executing the command in the windows cmd prompt.

D:/BB/bin/protoc object_detection/protos/*.proto --python_out=.

as for the reference in the installation process of object detection in this model.

in protobuf compilation.

awaiting response bug

Most helpful comment

This is my solution:
Head to the protoc releases page and download the protoc-3.4.0-win32.zip, extract it, and you will find protoc.exe in the bin directory.

Move this to models/research folder tensorflow model project

Next,you can use the protoc command like

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

Reference linking

All 60 comments

This is a typical bug of the object detection module working in Windows. Here are detailed discussion #1591.

A solution is to compile those .proto files one by one. You can write a batch to run.

@Hemanth2396 Indeed there is a problem with version 3.5.0 of protobuf on Windows. This line works fine for me using version 3.4.0. Get it from here:
https://github.com/google/protobuf/releases/tag/v3.4.0

@Hemanth2396 , do these suggestions resolve your issues? either writing a batch file, using 3.4 instead of 3.5, and the info on #1591?

I have try 3.4 but it also doesn't work. Has anyone solved the problem?

I have solved the problem. My mistake occurs because the directory of the files has been updated. So we should run cmd in 'research' file instead of 'models' file. I hope that helps.

i have the same problem . but after i install protobuff 3.4 , the error message become :Invalid argument . can anyone give a suggestion?

@Rulen9987 I also have the same or a similar issue.

I have tried using proto 3.4 and 3.5 to compile the .proto files individually with similar results however it appears there are dependencies between each proto file. I believe the dependencies are enumerated in the BUILD file but I'm not clear on how to use this file to control the order that proto builds.

Edit: I may have resolved the issue!

The directory structure for includes is fixed inside of each proto file e.g. anchor_generator.proto lives at "object_detection/protos/anchor_generator.proto".

This means that every time anchor_generator.proto calls an import like...

import "object_detection/protos/grid_anchor_generator.proto";

...it recurses from its pwd and cannot find the appropriate include.

I moved protoc.exe to "modelsmodels-masterresearch" and used...

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

...without any errors. This was with protoc 3.4 but I suspect 3.5 should be the same. This is likely not an issue with protoc but rather how directories should be referenced in Windows.

Edit: Edit: I changed the example proto file to the first one that will throw an error when a user tries to follow https://pythonprogramming.net/introduction-use-tensorflow-object-detection-api-tutorial/ so that it shows up more frequently when people search for that error

Same issue on my windows10 and anaconda3, i had install protoc3.4
2

With windows try running it separately. I had the same issue but running it one by one seems to work

ie protoc object_detection/protos/anchor_generator.proto --python_out=.

This is my solution:
Head to the protoc releases page and download the protoc-3.4.0-win32.zip, extract it, and you will find protoc.exe in the bin directory.

Move this to models/research folder tensorflow model project

Next,you can use the protoc command like

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

Reference linking

protoc-3.5.0-win32.zip is the source of the problem. I read everything in the protoc manuel but didnt figure the solution. but when I changed to protoc-3.4.0-win32 and put the protoc.exe into the research folder(in which I have object_detection folder). Run cmd protoc object_detection/protos/*.proto --python_out=. in the research folder and then no errors is reported, meaning successful compilation.

I installed protoc-3.4.0-win32.zip and this error was fixed. run cmd

[PATH TO PROTOC.EXE]/protoc object_detection/protos/*.proto --python_out=.

I used following powershell command on windows:
Get-ChildItem object_detection/protos/*.proto | Resolve-Path -Relative | %{ .\protoc $_ --python_out=. }

Thanks @obabac. That did the trick.

I installed v3.4.0 and it solved the issue

After 60 hour's trials and errors, I finally succeeded in compiling the Protobuf libraries.
I like to share my mistakes during compilation.

  1. First mistake : I used the protoc-3.5.0-win32 as a compiler.
  2. Second mistake :
    A. I located the Protobuf libraries into a wrong directory unlike the compilation guidline. All proto formated files to be compiled have designated path. I realized the fact through following error messege.

figure1

B. Also I figured out that the path to save compiled files(e.g., eval.py) has beed assigned.
figure2

[Here comes my solution]

  1. use the 3.4 version complier
  2. follow the path assinment as gitHub compilation guideline. Particaulary, do not chage the path in red box.
    ans1

If you still failed to compile the the Protobuf libraries, you may download the compiled protos files below.
protos.zip

Good luck!

This command solved my problem. However, you have to run this batch process in the research folder because some of the proto dependencies are hardcoded.

for /r %%v in (*.proto) do <YOUR_PROTO_PATH> object_detection\protos\%%~nv%%~xv --python_out=.

For windows, I had to compile all individual proto files in below folder Object_Detectionmodelsresearch\object_detection\protos. For some reason, *.proto is not picking all .proto files from this folder in this command.

Seems that the protoc version 3.5.1 cannot recognize the file extensions. However, version 3.4.0 is OK.

go to research> and just type protoc object_detection/protos/anchor_generator.proto --python_out=.
and enter(before that you have to set system path to protoc.exe)
Working Solution

go to research> and just type protoc object_detection/protos/anchor_generator.proto --python_out=.
and enter(before that you have to set system path to protoc.exe)
Working Solution

yes, the recursive call in protoc 3.5 its broken
quick workaround

protoc object_detection/protos/anchor_generator.proto --python_out=.
protoc object_detection/protos/argmax_matcher.proto --python_out=.
protoc object_detection/protos/bipartite_matcher.proto --python_out=.
protoc object_detection/protos/box_coder.proto --python_out=.
protoc object_detection/protos/box_predictor.proto --python_out=.
protoc object_detection/protos/eval.proto --python_out=.
protoc object_detection/protos/faster_rcnn.proto --python_out=.
protoc object_detection/protos/faster_rcnn_box_coder.proto --python_out=.
protoc object_detection/protos/grid_anchor_generator.proto --python_out=.
protoc object_detection/protos/hyperparams.proto --python_out=.
protoc object_detection/protos/image_resizer.proto --python_out=.
protoc object_detection/protos/input_reader.proto --python_out=.
protoc object_detection/protos/keypoint_box_coder.proto --python_out=.
protoc object_detection/protos/losses.proto --python_out=.
protoc object_detection/protos/matcher.proto --python_out=.
protoc object_detection/protos/mean_stddev_box_coder.proto --python_out=.
protoc object_detection/protos/model.proto --python_out=.
protoc object_detection/protos/multiscale_anchor_generator.proto --python_out=.
protoc object_detection/protos/optimizer.proto --python_out=.
protoc object_detection/protos/pipeline.proto --python_out=.
protoc object_detection/protos/post_processing.proto --python_out=.
protoc object_detection/protos/preprocessor.proto --python_out=.
protoc object_detection/protos/region_similarity_calculator.proto --python_out=.
protoc object_detection/protos/square_box_coder.proto --python_out=.
protoc object_detection/protos/ssd.proto --python_out=.
protoc object_detection/protos/ssd_anchor_generator.proto --python_out=.
protoc object_detection/protos/string_int_label_map.proto --python_out=.
protoc object_detection/protos/train.proto --python_out=.

I can confirm tha using protoc object_detection/protos/*.proto --python_out=. does the job when executed from the models/research directory (Protoc 3.4). All you need to do is to move the protoc.exe to the research folder .

Appreciated @kocetomad @HansaTharuka

FWIW, kocetomad's solution also works for Ubuntu 16.04. What a PITA this has been. Thanks!

crea un bat en windows
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\anchor_generator.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\argmax_matcher.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\bipartite_matcher.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\box_coder.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\box_predictor.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\aeval.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\faster_rcnn.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\faster_rcnn_box_coder.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\graph_rewriter.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\grid_anchor_generator.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\hyperparams.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\image_resizer.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\input_reader.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\keypoint_box_coder.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\losses.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\matcher.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\mean_stddev_box_coder.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\model.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\multiscale_anchor_generator.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\optimizer.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\pipeline.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\post_processing.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\preprocessor.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\region_similarity_calculator.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\square_box_coder.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\ssd.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\ssd_anchor_generator.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\string_int_label_map.proto --python_out=.
"C:\Users\jroldan\Desktopprotoc-3.5.1-win32\binprotoc" object_detection\protos\train.proto --python_out=.
pause

I can't seem to solve this by running the 3.4 version or by running each file individually. Either way I keep getting object_detection/protos/*: No such file or directory or object_detection/protos/anchor_generator.proto: No such file or directory.

Just to make sure I'm understanding correctly, are the *.proto files supposed to be present in the object_detection/protos folder before running the protoc command? Or are they outputs? I created the object_detection and protos folder, so there are no *.proto files there at this stage.

After trying this again in linux, I am still missing the models folder, including subfolders models/research/object_detection/protos. I ended up downloading the missing folders/files from https://github.com/tensorflow/models

Does anyone know why the installation with pip install tensorflow was missing those folders?

Hi,
First, I downloaded the missing files. >> Tensorflow/models

After that one by one write protoc --python_out=. .\object_detection\protos\multiscale_anchor_generator.proto

protoc --python_out=. .\object_detection\protos\model.proto more code bla bla bla.

I did this Anaconda3 and Windows 10. Protobuf 3.4

Sometimes,protobuf install failed for anaconda.
conda install -c anaconda protobuf
This code solve problems.

The reason why this happens is THE WINDOWS ENVIRONMENT. I'm sure you have the files, you are using the correct command line, but the cmd in anaconda windows is not working as it is in ubuntu or other linux system. (The "*" is not working the same way in unbuntu standing for other files with same extension here in Windows) Just go to the protos folder and copy&paste the following, and I'm sure if you have protobuf pip installed, this will fix the problem!!

protoc object_detection/protos/anchor_generator.proto --python_out=.
protoc object_detection/protos/argmax_matcher.proto --python_out=.
protoc object_detection/protos/bipartite_matcher.proto --python_out=.
protoc object_detection/protos/box_coder.proto --python_out=.
protoc object_detection/protos/box_predictor.proto --python_out=.
protoc object_detection/protos/eval.proto --python_out=.
protoc object_detection/protos/faster_rcnn.proto --python_out=.
protoc object_detection/protos/faster_rcnn_box_coder.proto --python_out=.
protoc object_detection/protos/grid_anchor_generator.proto --python_out=.
protoc object_detection/protos/hyperparams.proto --python_out=.
protoc object_detection/protos/image_resizer.proto --python_out=.
protoc object_detection/protos/input_reader.proto --python_out=.
protoc object_detection/protos/keypoint_box_coder.proto --python_out=.
protoc object_detection/protos/losses.proto --python_out=.
protoc object_detection/protos/matcher.proto --python_out=.
protoc object_detection/protos/mean_stddev_box_coder.proto --python_out=.
protoc object_detection/protos/model.proto --python_out=.
protoc object_detection/protos/multiscale_anchor_generator.proto --python_out=.
protoc object_detection/protos/optimizer.proto --python_out=.
protoc object_detection/protos/pipeline.proto --python_out=.
protoc object_detection/protos/post_processing.proto --python_out=.
protoc object_detection/protos/preprocessor.proto --python_out=.
protoc object_detection/protos/region_similarity_calculator.proto --python_out=.
protoc object_detection/protos/square_box_coder.proto --python_out=.
protoc object_detection/protos/ssd.proto --python_out=.
protoc object_detection/protos/ssd_anchor_generator.proto --python_out=.
protoc object_detection/protos/string_int_label_map.proto --python_out=.
protoc object_detection/protos/train.proto --python_out=.
protoc object_detection/protos/graph_rewriter.proto --python_out=.

@eaglep91 Yes true. I did this to me. One by one.

@eaglep91 , thank for the solution. I copied all the commands into a bat file and execute the bat file once. :)

worked for me, add a param 'proto_path' to the command.
in folder research,
protoc object_detection\protos\*.proto --python_out=. --proto_path=.

FOR %i IN (object_detection/protos/*.proto) DO protoc object_detection/protos/%i --python_out=.

This is my solution:
Head to the protoc releases page and download the protoc-3.4.0-win32.zip, extract it, and you will find protoc.exe in the bin directory.

Move this to models/research folder tensorflow model project

Next,you can use the protoc command like

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

Reference linking

Lifesaver of the day .i have been trying to get a solution for about 4 days now and i have finally managed to solve the issue by using your guide

Just write bellow code in cmd ,the only change is you have to put is " --python_out=. " before the path then

`for /f %i in ('dir /b object_detection\protos*.proto') do protoc --python_out=. object_detection\protos\%i`

  • Download.
    https://github.com/tensorflow/models

  • Go to folder "research".
    Open terminal: cd Downloads/models/research

  • (for python 2) python setup.py build
    (for python 3) python3 setup.py build

  • (for python 2) sudo python setup.py install
    (for python 3) sudo python3 setup.py install

  • You'll see : "Finished processing dependencies for object-detection==0.1"

As mentioned above the error takes place in while executing the command in the windows cmd prompt.

D:/BB/bin/protoc object_detection/protos/*.proto --python_out=.

as for the reference in the installation process of object detection in this model.

in protobuf compilation.

beacuse u cant write the correct path.modify the all path.jsut like:C://Destop//...

As protoc on windows probably not supporting patterns use powershell script:

Set-Location {###YOUR DRIVE###}:\models\research
$relativePath = Get-ChildItem object_detection\protos\*.proto | Resolve-Path -Relative 

 foreach ($item in $relativePath) 
{
&protoc $item --python_out=.\object_detection\protos
}

Create a *.bat file with this text and run it:
for %%f in (object_detection\protos*.proto) do protoc "%%f" --python_out=.

I have solved the problem. My mistake occurs because the directory of the files has been updated. So we should run cmd in 'research' file instead of 'models' file. I hope that helps.

Thanks a lot sir, you saved my life

run the .proto files individually, it worked for me. I used protoc version 3.7.0.

Hi It occurred same problem.check the command prompt screen that I shot.

command line
C:\Users\xxx\Anaconda3\models-master\research>protoc object_detection/protos/*.proto --python_out=.

Also I already confirmed the target directory follow
C:\Users\xxx\Anaconda3\models-master\research\object_detection\protos

But the I couldn't remove the error
object_detection/protos/*.protos: No such file or directory

001001
environment
win10
anaconda3

Thx in advance

@k31ww475, on windows, you have to individually run the script. You can't write like *.proto on windows to generalize it for each file. Compile every. Proto file individually with individual command which is a little bit of hectic thing to do.

so should I type the command follow,when I compile on windows?

for /f %i in ('dir /b object_detection\protos*.proto') do protoc object_detection\protos\%i --python_out=.

hey , you should run command in research folder instead of protos folder ! this works for me :
cd C:\Users\xxx\Anaconda3models-masterresearch

Write this bat code to "research" folde,and run it:
`
::@echo off
set DIR="%cd%/object_detection/protos/"
echo DIR=%DIR%

for /R %DIR% %%f in (*.proto) do (
::echo %%f
protoc %%f --python_out=. --proto_path "%cd%"
)
pause
`

Thank you ArghyaChatterjee MahmudaEva06 and codeoflin.It works.

download and run this .bat file in /model/research/
eaglep91 list missed this line:
protoc object_detection/protos/calibration.proto --python_out=.

Simple solution for Windows CMD:
Run this in CMD in modelsresearch folder:
for /f %f in ('dir /b object_detection\protos\*.proto') do protoc object_detection\protos\%f --python_out=.

go to research> and just type protoc object_detection/protos/anchor_generator.proto --python_out=.
and enter(before that you have to set system path to protoc.exe)
Working Solution

how do i set system path to protoc.exe??

go to research> and just type protoc object_detection/protos/anchor_generator.proto --python_out=.
and enter(before that you have to set system path to protoc.exe)
Working Solution

how do i set system path to protoc.exe??

  1. download protoc-3.8.0-win64.zip from github-release
  2. extract in a directory and copy address of that
  3. open start
  4. type environment variable (in search)
  5. open Edit environment variable
  6. click on Environment variables...
  7. find "Path" in list
  8. click Edit
  9. click New and paste address of extracted folder in the bottem of list
  10. OK all and restart PC

Thanks @Amin-Tgz for your prompt response!!

have a good day!

I have solved the problem. My mistake occurs because the directory of the files has been updated. So we should run cmd in 'research' file instead of 'models' file. I hope that helps.

it worked for me thanks

This is my solution:
Head to the protoc releases page and download the protoc-3.4.0-win32.zip, extract it, and you will find protoc.exe in the bin directory.

Move this to models/research folder tensorflow model project

Next,you can use the protoc command like

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

Reference linking

quickest solution!

I used following powershell command on windows:
Get-ChildItem object_detection/protos/*.proto | Resolve-Path -Relative | %{ .\protoc $_ --python_out=. }

It works !!!!

Thanks @Amin-Tgz for this..

I am using protoc version 3.7 on Win10 64bit, the same issue happened. Instead of doing manually 1 by 1, use this for loop,
At path, "modelsresearch" for %i in (object_detection\protos\*) do protoc %i --python_out=.

I can confirm tha using protoc object_detection/protos/*.proto --python_out=. does the job when executed from the models/research directory (Protoc 3.4). All you need to do is to move the protoc.exe to the research folder .

I agree. I went to the research directory and ran the script; avoid running from the object_detection directory!

I was getting the error on Jupyter Notebook too, was using Windows 10,The solution what worked for me was that i installed on Ubuntu (WSL) this package:
sudo apt-get install protobuf-compiler
It solved my issue now i'm having cannot find pip issue,still new to the topic so dont fully understand how each element work together,so cannot provide in depth technical explanation why it worked.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

walkerlala picture walkerlala  路  98Comments

pjeambrun picture pjeambrun  路  51Comments

yuanzhuohao picture yuanzhuohao  路  81Comments

NilsLattek picture NilsLattek  路  61Comments

aifollower picture aifollower  路  49Comments