Skip to content
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

cannot import name 'image_module_info_pb2' #167

Closed
RickZLLiao opened this issue Sep 25, 2018 · 6 comments
Closed

cannot import name 'image_module_info_pb2' #167

RickZLLiao opened this issue Sep 25, 2018 · 6 comments
Assignees

Comments

@RickZLLiao
Copy link

When i run : python retrain.py --image_dir='G:\work\Other\Band/Data', i got an error :
cannot import name 'image_module_info_pb2'
File 'image_module_info_pb2' was lost in the github.

@arnoegw arnoegw self-assigned this Sep 25, 2018
@arnoegw
Copy link
Contributor

arnoegw commented Sep 25, 2018

If I may ask, what was the exact workflow that got you there?

The source file image_module_info.proto was added by
acdacbd
Just like other *.proto files (including the most fundamental module_def.proto), it requires running bazel build ... to be compiled into a *_pb2.py file.

@RickZLLiao
Copy link
Author

@arnoegw
Thanks for your reminding. I had compiled *.proto to *_pb2.py file. And I will try it.

@arnoegw
Copy link
Contributor

arnoegw commented Sep 26, 2018

I hope that solves it for you. Please reopen if not.

@arnoegw arnoegw closed this as completed Sep 26, 2018
@newistar
Copy link

If I may ask, what was the exact workflow that got you there?

The source file image_module_info.proto was added by
acdacbd
Just like other *.proto files (including the most fundamental module_def.proto), it requires running bazel build ... to be compiled into a *_pb2.py file.

I am getting this error, while trying Bazel build command on a .proto file

ERROR: Skipping 'tensorflow_hub/image_module_info.proto': error loading package 'tensorflow/examples/image_retraining/tensorflow_hub': Unable to load package for '//tensorflow_hub:protos.bzl': BUILD file not found on package path

@davelet
Copy link

davelet commented Apr 22, 2019

any progress? or how to solve it? I met the issue too:

Traceback (most recent call last):
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 183, in _run_module_as_main
    mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 109, in _get_module_details
    __import__(pkg_name)
  File "/Users/sheldon/pythonProjects/hub/examples/image_retraining/retrain.py", line 132, in <module>
    import tensorflow_hub as hub
  File "/Users/sheldon/pythonProjects/hub/tensorflow_hub/__init__.py", line 32, in <module>
    from tensorflow_hub.feature_column import image_embedding_column
  File "/Users/sheldon/pythonProjects/hub/tensorflow_hub/feature_column.py", line 24, in <module>
    from tensorflow_hub import image_util
  File "/Users/sheldon/pythonProjects/hub/tensorflow_hub/image_util.py", line 21, in <module>
    from tensorflow_hub import image_module_info_pb2
ImportError: cannot import name 'image_module_info_pb2' from 'tensorflow_hub'

@vbardiovskyg
Copy link
Contributor

vbardiovskyg commented Apr 23, 2019

I am actually not sure how this is happening. If you have installed tensorflow_hub, the retrain script should be importing from there, so:
pip install tensorflow_hub --upgrade

Otherwise you have to make it to import from your working directory and the way to build the files is to use:
bazel build tensorflow_hub:all from the top level directory.

(Not bazel build ...)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants