tensorboard: `%tensorboard` doesn’t work with `%tensorflow_version 1.x` (duplicate plugins for name whatif)

Every few months, the colab tutorials released by my team seem to break due to updates made to the Colab environment. The reason is due to multiple tensorboard versions being installed.

As a result of this, I run the following code snippet before running TensorBoard each time:

# Remove all TensorBoard packages.
! pip list --format=freeze | grep tensorboard | xargs pip uninstall -y
# Install TensorFlow again (This command will only install the default TensorBoard package associated with this TensorFlow package). 
! pip install -q tensorflow

Seems like many users also face this issue often: https://github.com/pytorch/pytorch/issues/22676

Not sure if this is a Colab or a Tensorboard issue, but I’m posting it here.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 2
  • Comments: 20 (16 by maintainers)

Commits related to this issue

Most upvoted comments

Hi @MeghnaNatraj! I can reproduce this error by running

%tensorflow_version 1.x
%load_ext tensorboard
%tensorboard --logdir logs

in a blank notebook with a fresh Colab runtime.

Could you please point us to an example notebook that runs into this problem? I looked at a few TF Lite Colabs (flowers_tf_lite.ipynb, text_classification.ipynb, image_classification.ipynb) but didn’t find any that used TensorBoard. It would be great to verify that the fixes that we put in actually work for your use case.

It looks like the problem is that %tensorflow_version 1.x adds an entry to the Python path for TF 1.x, which suffices for new or superseding versions of packages, but doesn’t suffice to remove packages that must not exist in 1.x, like tensorboard_plugin_wit. I’ll see if we can fix this on the Colab side, and failing that I’ll look into whether we might want to backport a patch to 1.15.

Should be deployed in prod:

Screenshot of repro, now working

@MeghnaNatraj: This should roll out in the next few days. (The change has been submitted internally and just needs to be deployed.)

@arya46: You almost got it 😃 !pip install -U tensorboard_plugin_wit, with -U for “upgrade”.