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

'tensorboard.plugins.projector' has no attribute 'ProjectorConfig' #926

Closed
marcevrard opened this issue Jan 31, 2018 · 8 comments
Closed

Comments

@marcevrard
Copy link

marcevrard commented Jan 31, 2018

Referring to the test file:
https://github.com/tensorflow/tensorboard/blob/1.5/tensorboard/plugins/projector/projector_api_test.py

If projector is imported as:

from tensorboard.plugins import projector
config = projector.ProjectorConfig()

accessing the ProjectorConfig() raises:
AttributeError: module 'tensorboard.plugins.projector' has no attribute 'ProjectorConfig'

It works fine if projector is imported from tf.contrib:

from tensorflow.contrib.tensorboard.plugins import projector

tensorboard == 1.5.0
tensorflow == 1.5.0
Python == 3.6.3
Ubuntu == 17.10
@chihuahua
Copy link
Member

Hmm, importing ProjectorConfig should work due to this line:

from tensorboard.plugins.projector.projector_config_pb2 import ProjectorConfig

I wonder why not. I wonder what happens if you install tensorboard nightly (pip install tb-nightly) and thus run on the bleeding edge version.

@marcevrard
Copy link
Author

Just tried and got the exact same error.

@nfelt
Copy link
Contributor

nfelt commented Feb 1, 2018

Upon further investigation, it looks like the actual contents of our __init__.py files isn't being preserved during our pip package building. We didn't notice because most of them are empty (aside from a license) and Bazel evidently creates its own empty __init__.py files by default: bazelbuild/bazel#4470

The projector plugin is pretty much the only non-empty one aside from the top-level one, which is specifically listed in its Bazel rule and does get included. I think if we start explicitly listing the other ones that should fix this issue.

@nfelt
Copy link
Contributor

nfelt commented Feb 1, 2018

For now, a workaround should be to explicitly import from projector_config_pb2 as in

from tensorboard.plugins.projector.projector_config_pb2 import ProjectorConfig
config = ProjectorConfig()

@marcevrard
Copy link
Author

Though the function visualize_embeddings() won't be available either.
My current workaround is thus to import from:

from tensorflow.contrib.tensorboard.plugins import projector

Are there any possible issues using the tf.contrib module instead of the tb root module? (I guess this will be still supported for a while)

@nfelt
Copy link
Contributor

nfelt commented Feb 1, 2018

Oh, yes, you're right. I believe that will work for now but it will be safer to import from tensorboard once we get that working.

@nfelt nfelt closed this as completed in #934 Feb 2, 2018
nfelt added a commit that referenced this issue Feb 2, 2018
Fix #926 by explicitly including the projector module API, i.e. `import tensorboard.plugins.projector`, which provides access to `visualize_embeddings`, when building the pip package.
nfelt added a commit to nfelt/tensorboard that referenced this issue Feb 7, 2018
Fix tensorflow#926 by explicitly including the projector module API, i.e. `import tensorboard.plugins.projector`, which provides access to `visualize_embeddings`, when building the pip package.
nfelt added a commit that referenced this issue Feb 7, 2018
Fix #926 by explicitly including the projector module API, i.e. `import tensorboard.plugins.projector`, which provides access to `visualize_embeddings`, when building the pip package.
@marcevrard
Copy link
Author

I checked with the latest package (tb-nightly-1.6.0a20180206) and it works perfectly.
Thanks for the swift fix!

@nfelt
Copy link
Contributor

nfelt commented Feb 7, 2018

Sure. This should also be fixed in 1.5.1 (just released yesterday) and will be in the upcoming 1.6.0 as well.

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

No branches or pull requests

3 participants