4
votes

I'm getting an error opening tensorboard. This is my code:

import tensorflow as tf
a = tf.constant(5,name = 'input_a')
b = tf.constant(3,name = 'input_b')
c = tf.multiply(a,b,name='mul_c')
d = tf.add(a,b,name='add_d')
e = tf.add(c,d,name = 'add_e')
with tf.Session() as sess:
    output = sess.run(e)
    print(output)
    writer = tf.summary.FileWriter('path/to/log',tf.get_default_graph())
    writer.close()

This is the command:

tensorboard --logdir=path/to/log  

This is the ERROR:

File "c:\programdata\anaconda3\lib\runpy.py", line 85, in _run_code exec(code, run_globals)
File "C:\ProgramData\Anaconda3\Scripts\tensorboard.exe__main__.py", line 5, in
File "c:\programdata\anaconda3\lib\site-packages\tensorboard\main.py", line 36, in
from tensorboard.plugins.audio import audio_plugin
File "c:\programdata\anaconda3\lib\site-packages\tensorboard\plugins\audio\audio_plugin.py", line 27, in
from tensorboard import plugin_util
File "c:\programdata\anaconda3\lib\site-packages\tensorboard\plugin_util.py", line 21, in
import bleach
File "c:\programdata\anaconda3\lib\site-packages\bleach__init__.py", line 14, in
from html5lib.sanitizer import HTMLSanitizer
File "c:\programdata\anaconda3\lib\site-packages\html5lib\sanitizer.py", line 7, in
from .tokenizer import HTMLTokenizer
File "c:\programdata\anaconda3\lib\site-packages\html5lib\tokenizer.py", line 17, in
from .inputstream import HTMLInputStream
File "c:\programdata\anaconda3\lib\site-packages\html5lib\inputstream.py", line 9, in
from .constants import encodings, ReparseException
ImportError: cannot import name 'encodings'

3
It looks like you might have an old version of html5lib installed... can you try upgrading it using pip install -U html5lib?mrry

3 Answers

9
votes

I got the same error and fixed it. Apparently, there is a problem with html5lib, but mrry's suggestion does not solve it because a message will tell you that you already have the latest version installed.

Instead, run this:

pip install html5lib==1.0b8

More about this issue here: https://github.com/xhtml2pdf/xhtml2pdf/issues/318.

2
votes

I had the same problem with Anaconda. This worked for me:

pip uninstall html5lib
conda install -c anaconda html5lib
pip install html5lib==1.0b10
0
votes

I had the same problem and I solved it by installing python 3.7.2 instead of 3.7.

I also deleted the python file left behind 3.7 in directory C:\Users\Your_user_name\appdata\local\programs\python before installing 3.7.2.