-
Notifications
You must be signed in to change notification settings - Fork 45.6k
ImportError: cannot import name 'string_int_label_map_pb2' #1595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Make sure you run |
Thanks mat for the quick response. Couple of hits got me to these links, but It did not help me find the directory For windows OS, the steps need to be better? |
@bsrinivas84 tensorflow/models refers to the root of the git checkout. |
Thanks Derek, realized first I had to install protoc-3.2.0-windows-x86_64.exe from https://github.com/google/protobuf/releases (pointed environment variables to include the path to installation) and then go to root and run the command. It worked, Many Thanks |
Anybody who is getting an import error in Jupyter notebook even after updating the PYTHONPATH make sure you restart the notebook. (i wasted couple of hours trying to chase down this problem) |
Mahesh which error are you getting? If its the protof please follow the instructions here to install as pointed above Also make sure you re-download the latest version of code |
i am still beginner i am trying to install tensorflow object detection API on windows i followed the instruction like that :
|
yes, i got the same error as 4saad mentioned, i checked the builder folder, where i found the anchor_generator-pb2.py which it has already been there, i still got the error like this |
I also got the same error as 4saad mentioned that cannot import name 'anchor_generator_pb2' even if i found the file of ' anchor_generator-pb2.py'. C:\Users\swg\Anaconda3\Lib\site-packages\tensorflow\models>python |
Hi songwg188, do you found any solution for the issue? I have also faced same problem as you mentioned. import is working from python environment, but I couldn't run the following command: |
i had the same error,but i solved it. make sure your protoc version >=2.6,download tensorflow/model to a new folder ,and re-install it. |
The application is looking for anchor_generator_pb2 in /usr/local/python3. Include the path in the python environment as mentioned in the installation guide. Or install the object_detection API with models/setup.py. All the libraries will be then installed. |
Thanks. I have solved the issue. Actually I have to delete the log before running next time. That creates problem.
Sujan Chowdhury
From: tj27 <[email protected]>
To: tensorflow/models <[email protected]>
Cc: Sujan Chowdhury <[email protected]>; Comment <[email protected]>
Sent: Monday, September 11, 2017 12:09 AM
Subject: Re: [tensorflow/models] ImportError: cannot import name 'string_int_label_map_pb2' (#1595)
The application is looking for anchor_generator_pb2 in /usr/local/python3. Include the path in the python environment as mentioned in the installation guide. Or install the object_detection API with models/setup.py. All the libraries will be then installed.—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub, or mute the thread.
|
hej I guess it's because the jupyter notebook already is in the object_detection directory. @sujanchy what log to clear? |
I get
when I run
On my windows 10 machine. What could be the problem? |
Okay, I can reproduce that output. |
Make sure you run: From tensorflow/models/research/protoc object_detection/protos/*.proto --python_out=. From tensorflow/models/research/export PYTHONPATH=$PYTHONPATH: |
@fera0013 , if you're on windows and running that command it won't work, for some reason it doesn't recognize /* as iterating thru all .proto files, you will have to manually (or create a batch file) do all .proto files one by one: |
I am using windows 10 with python 3.6.3 However, I also have the same problem when run Is there other way to solve this problem? |
On windows 10, assuming that you fixed protoc issues as indicated above, I then copied copied related egg files into my libray path (related to my tensorflow environment): C:\Users\test\Anaconda3\envs\tensorflow\Lib\site-packages I finally have in this folder following files:
and folders:
this allowed to run from Anaconda prompt (in_..\models\research_) the test command indicated in installation guidelines: |
In my case, the proto folder contains no file named 'string_int_label_map_pb2' instead there is a file named string_int_label_map.proto but still i am not able to import that file please help me |
My problems was :
On Ubuntu17 and with tensorflow 1.6 @gedeon1310 's solution worked for me too. Thanks |
same problom on windows7, download protoc-3.6.1-win32.zip,place protoc.exe to environment path ,then copy protoc.exe to C:\Windows\systerm32,then run complie protoc object_detection/protos/*.proto --python_out=.,done |
I am getting the same error, and the link provided here seems to be broken. Any workaround for this? I am working on ubuntu 16.04 |
The new protoc version does not allow you to do protoc object_detection/protos/*.proto --python_out=. I hope you understand that *.proto executes the above command for all files with extension .proto in the object_detection/protos/ folder. In the new version, you will need to compile each file in protos folder individually as, for example, protoc object_detection/protos/anchor_generator.proto --python_out=. |
I am working on a Windows 10 machine. '...bin\protoc.exe' was added to my path, but for some reason the .proto files were not being converted to .py files with the command The solution that worked for me was to include the root of protoc.exe in the command using MINGW64: |
protoc object_detection/protos/*.proto --python_out=. getting following response on running command. |
this,restarting the kernel and "from protos import string_int_label_map_pb" worked for me .. |
This is not running in my pc is there any there solution i can do |
Here is the new link |
I got a very easy solution It will solve your error |
Doing this and switching the import from 'object_detection.protos' to just 'protos' fixed it for me |
I tried all of this but still no luck. Instead I had to also change the importobject_detection.utlis to from object_detection.utils import ops as utils_ops |
I downloaded and installed protoc from source, and it worked for me:
Then, test the installation:
|
how to slove this error? |
ImportError: cannot import name 'string_int_label_map_pb2'
|
This error can be solved by editing object_detection/utils/label_map_util.py |
I am having the same problem and it's been a couple of days |
I am getting error like this in jupyter have you solved it ? |
Error: cannot import name 'string_int_label_map_pb2' from 'object_detection.protos' I solved this error simply by moving the .ipynb file to 'research' folder |
In step "Object detection imports" I am getting the following error
ImportError Traceback (most recent call last)
in ()
----> 1 from utils import label_map_util
2
3 from utils import visualization_utils as vis_util
D:\Personal\learn\ML\DL\Tensorflow\Official-Tutorial\models-master\object_detection\utils\label_map_util.py in ()
20 import tensorflow as tf
21 from google.protobuf import text_format
---> 22 from object_detection.protos import string_int_label_map_pb2
23
24
ImportError: cannot import name 'string_int_label_map_pb2'
To workaround/proceed I commented the following line in "label_map_util.py"
from object_detection.protos import string_int_label_map_pb2
But I am now getting error at step "Loading label map"
NameError: name 'string_int_label_map_pb2' is not defined
So need your help to solve the error in step "Object detection imports"
Appreciate the help to proceed further
The text was updated successfully, but these errors were encountered: