Tensorboard: ImportError: cannot import name 'run_main' - Unable to launch tensorboard

Created on 14 Jan 2018  Â·  21Comments  Â·  Source: tensorflow/tensorboard

(DL) ♦ ~ / ➞  tensorboard
/Users/carbon/Dev/anaconda/envs/DL/lib/python3.6/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Traceback (most recent call last):
  File "/Users/carbon/Dev/anaconda/envs/DL/bin/tensorboard", line 7, in <module>
    from tensorboard.main import run_main
ImportError: cannot import name 'run_main'

I built Tensorflow from the latest 1.5.0rc0 release.

tensorflow (1.5.0rc0)
tensorflow-tensorboard (0.1.8)

Referencing: https://github.com/tensorflow/tensorflow/issues/16011

builinstall

Most helpful comment

This is due to a mismatch in the version of tensorboard installed versus the version of tensorflow; run_main is not present until tensorflow-tensorboard >= 0.4.0rc1. The actual 1.5.0 tensorflow release should have a corrected version specifier that updates tensorboard appropriately on install.

For now, doing a manual pip install -U tensorflow-tensorboard==0.4.0rc3 should resolve this problem. You can also do pip install tb-nightly as recommended above.

All 21 comments

This issue also affects the latest development docker image from tensorflow

Apparently, after a bit of Googling, I found this issue which has the solution: https://github.com/tensorflow/tensorboard/issues/812

make sure to install pip install tb-nightly when building tensorflow from source until the changes are migrated to official distribution channels.

The issue is still live for the Docker image, please do not close this issue.

@DEKHTIARJonathan Same to me.

Tensorflow 1.5.0-rc0-gpu build on ppc64le, same error on tensorboard launch:

from tensorboard.main import run_main
ImportError: cannot import name 'run_main'

Any hints?

cc @jart @chihuahua

This is due to a mismatch in the version of tensorboard installed versus the version of tensorflow; run_main is not present until tensorflow-tensorboard >= 0.4.0rc1. The actual 1.5.0 tensorflow release should have a corrected version specifier that updates tensorboard appropriately on install.

For now, doing a manual pip install -U tensorflow-tensorboard==0.4.0rc3 should resolve this problem. You can also do pip install tb-nightly as recommended above.

@nfelt - I don't know if you have control on this, however it would be nice that TF 1.5.0 is not officially released with a non-functioning docker image.
It should be quite easy to fix it, maybe the Dockerfile ? It would be a pleasure for me to help you fixing this if needed.

@nfelt absolutely has control. The same could be said for any other member of the team. I LGTM'd a change of his internally a few hours ago which works towards solving this issue. That change should get exported sometime tomorrow.

We're grateful for the feedback we receive from members of the community who test our release candidates. This release has been an especially challenging one. There have been other major concerns raised too, due to a variety of vendor constraints, leading to things like us needing to rewrite our C++ toolchain to maintain support for Linux installs older than one year. Very fun stuff.

If there's one thing I can promise you it's that, when we're ready to declare 1.5.0 proper, it will exceed your expectations.

@jart It's always a real pleasure to help. You people helped me so much all along my PhD , it's the rightful thing to do to give as much help as I can in return. Just ping me, if you need help on some stuff.

As soon as the new RC image is released, I will report back how things goes.
I get my mind ready to be blown away by this new release !

Please do not hesitate to ask for help if needed, I can manage to free some spare hours in my schedule.

Please have a nice day,

While we aim to exceed, I can't promise mind-blowing, but we'll certainly try our best. For example, I'm very excited about Eager execution mode (but what comes after that is… whew.) I'm also looking forward to some of the announcements the TensorBoard team can make in terms of work on plugin development.

Congratulations on your PhD. It always makes me happy to hear we have friends we can count on. Paying forward kindness is what open source is all about. It's why I love working on these sorts of projects.

@jart : Speaking of plugins, if you don't know this one: https://github.com/lspvic/jupyter_tensorboard
It's a quite a cool and useful productivity hack, it would be very nice to have it by default in the official docker image.

I like that project. I think it demonstrates an important niche we're hoping TensorBoard can serve in the upcoming future. Especially considering the state of the TF Docker setup. I'll definitely be taking a closer look at that codebase soon, since I'm always interested in learning about the heroics people manage to achieve with customized TensorBoard repos.

A workaround that worked for me - running tensorboard directly, i.e

python3 /usr/local/lib/python3.5/dist-packages/tensorboard/main.py --logdir=/tmp/

Maybe helpful for someone else.

@jart : I have tested the new docker images:

Closing this since I believe it should be fully addressed in TF 1.5.0+ by https://github.com/tensorflow/tensorflow/commit/14794bd936e98e4dac5f27118111d863514a9ac9 which updates TF's dependency on TB to >= 0.4.0, given that TB 0.4.0+ should have run_main. Please re-open if you see this again with anything other than the TF 1.5.0-rc{0,1} candidates.

Trying out Tensorboard still throws this error.

$ tensorboard --logdir output/
Traceback (most recent call last):
  File "/usr/bin/tensorboard", line 7, in <module>
    from tensorboard.main import run_main
ImportError: cannot import name 'run_main'

Installed pip packages: tensorflow-gpu 1.5.0, tensorboard 1.6.0
This is on PTB recurrent language model (from official TF tutorial) where results are saved into output dir. I also tried tb-nightly.

Ok, running it directly using full path works.

Hmm, this might be resolved if you pip uninstall everything tensorboard (including tensorflow-tensorboard if you still have it) and then pip install tensorboard. If that doesn't work, could you include the results of running pip freeze and which tensorboard ?

Yes, reinstalling tensorflow/tensorboard fixed it. Strangely though, tensorboard pip version is 1.6.0 but tensorflow-gpu pulls tensorflow-tensorboard 1.5.0. I wonder if these packages are anything different.

For versions prior to 1.6.0 we used the tensorflow-tensorboard package name. Since pip doesn't have a notion of package renames, it's not aware that tensorboard 1.6.0 should replace tensorflow-tensorboard 1.5.0. See here under "Known issues" for details:
https://github.com/tensorflow/tensorboard/releases/tag/1.6.0

Once TF 1.6 is out, installing it should only install tensorboard and not tensorflow-tensorboard. In the mean time, as long as it's working, it's harmless to leave tensorflow-tensorboard installed.

I've tried all the methods above but it still doesn't work until I removed this directory:
~/.local/lib/python3.5/site-packages/tensorboard

Wish this could help.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

datlife picture datlife  Â·  4Comments

OverLordGoldDragon picture OverLordGoldDragon  Â·  3Comments

ismael-elatifi picture ismael-elatifi  Â·  3Comments

wchargin picture wchargin  Â·  3Comments

smatsumori picture smatsumori  Â·  4Comments