tensorboard: Blank Page in Browser (and other error)

When starting tensorboard I only get a blank white page. Tested on multiple browsers and scripts. I just updated to the new Tensorflow 2.0, yesterday with the older version it worked. If I mark the page it just shows 4 blue vertical lines. Inspecting the web page with chrome shows a lot of html code. Using VSCode, Win10 Chrome and Firefox.

I start tensorboard with any of these: tensorboard --logdir ./logs tensorboard --logdir ./logs --bind_all tensorboard --logdir ./logs --host localhost --port 8080

Results are the same.

strange other error

Also I get a strange error now with the new version if I take the official example and create the log_dir in the following way: log_dir="logs/fit/" + datetime.datetime.now().strftime("%Y%m%d-%H%M%S") It raises the error “tensorflow.python.framework.errors_impl.NotFoundError: Failed to create a directory: logs/fit/20200107-131107\train; No such file or directory [Op:CreateSummaryFileWriter]” So I have to use os.path.join or just take no subdirectories.

Example file to reconstruct error

from datetime import datetime
import tensorflow as tf

mnist = tf.keras.datasets.mnist
(x_train, y_train),(x_test, y_test) = mnist.load_data()

def create_model():
  return tf.keras.models.Sequential([
    tf.keras.layers.Flatten(input_shape=(28, 28)),
    tf.keras.layers.Dense(512, activation='relu'),
    tf.keras.layers.Dropout(0.2),
    tf.keras.layers.Dense(10, activation='softmax')
  ])


model = create_model()
model.compile(optimizer='adam',
              loss='sparse_categorical_crossentropy',
              metrics=['accuracy'])

log_dir= datetime.now().strftime("%Y%m%d-%H%M%S")
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)

model.fit(x=x_train, 
          y=y_train, 
          epochs=1, 
          validation_data=(x_test, y_test), 
          callbacks=[tensorboard_callback])


Diagnostics

Diagnostics output
--- check: autoidentify
INFO: diagnose_tensorboard.py version d515ab103e2b1cfcea2b096187741a0eeb8822ef

--- check: general
INFO: sys.version_info: sys.version_info(major=3, minor=6, micro=7, releaselevel='final', serial=0)
INFO: os.name: nt
INFO: os.uname(): N/A
INFO: sys.getwindowsversion(): sys.getwindowsversion(major=10, minor=0, build=17763, platform=2, service_pack='')

--- check: package_management
INFO: has conda-meta: False
INFO: $VIRTUAL_ENV: None

--- check: installed_packages
INFO: installed: tensorboard==2.1.0
INFO: installed: tensorflow==2.0.0
INFO: installed: tensorflow-estimator==2.0.1

--- check: tensorboard_python_version
INFO: tensorboard.version.VERSION: '2.1.0'

--- check: tensorflow_python_version
INFO: tensorflow.__version__: '2.0.0'
INFO: tensorflow.__git_version__: 'v2.0.0-rc2-26-g64c3d382ca'

--- check: tensorboard_binary_path
INFO: which tensorboard: b'C:\\Python3\\Scripts\\tensorboard.exe\r\n'

--- check: addrinfos
socket.has_ipv6 = True
socket.AF_UNSPEC = <AddressFamily.AF_UNSPEC: 0>
socket.SOCK_STREAM = <SocketKind.SOCK_STREAM: 1>
socket.AI_ADDRCONFIG = <AddressInfo.AI_ADDRCONFIG: 1024>
socket.AI_PASSIVE = <AddressInfo.AI_PASSIVE: 1>
Loopback flags: <AddressInfo.AI_ADDRCONFIG: 1024>
Loopback infos: [(<AddressFamily.AF_INET6: 23>, <SocketKind.SOCK_STREAM: 1>, 0, '', ('::1', 0, 0, 0)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 0, '', ('127.0.0.1', 0))]
Wildcard flags: <AddressInfo.AI_PASSIVE: 1>
Wildcard infos: [(<AddressFamily.AF_INET6: 23>, <SocketKind.SOCK_STREAM: 1>, 0, '', ('::', 0, 0, 0)), (<AddressFamily.AF_INET: 2>, <SocketKind.SOCK_STREAM: 1>, 0, '', ('0.0.0.0', 0))]

--- check: readable_fqdn
INFO: socket.getfqdn(): 'dnpc.ddns.lcl'

--- check: stat_tensorboardinfo
INFO: directory: C:\Users\Public\Documents\Wondershare\CreatorTemp\.tensorboard-info
INFO: os.stat(...): os.stat_result(st_mode=16895, st_ino=3096224744537609, st_dev=1926005927, st_nlink=1, st_uid=0, st_gid=0, st_size=0, st_atime=1578399251, st_mtime=1578399251, st_ctime=1578397643)
INFO: mode: 0o40777

--- check: source_trees_without_genfiles
INFO: tensorboard_roots (1): ['C:\\Python3\\lib\\site-packages']; bad_roots (0): []

--- check: full_pip_freeze
INFO: pip freeze --all:
absl-py==0.7.0
astor==0.7.1
attrs==19.1.0
backcall==0.1.0
bayespy==0.5.18
bleach==3.1.0
cachetools==4.0.0
certifi==2019.3.9
chardet==3.0.4
click==7.0
clickclick==1.2.2
colorama==0.4.1
connexion==1.1.15
cycler==0.10.0
Cython==0.29.11
decorator==4.3.2
defusedxml==0.5.0
dlib==19.17.0
entrypoints==0.3
flask==1.0.3
gast==0.2.2
gmplot==1.2.0
google-auth==1.10.0
google-auth-oauthlib==0.4.1
google-pasta==0.1.8
gpx-parser==0.0.4
grpcio==1.26.0
h5py==2.9.0
idna==2.8
imageio==2.5.0
importlib==1.0.4
inflection==0.3.1
ipykernel==5.1.0
ipython==7.3.0
ipython-genutils==0.2.0
ipywidgets==7.4.2
itsdangerous==1.1.0
jedi==0.13.3
Jinja2==2.10
joblib==0.13.2
jsonschema==3.0.1
jupyter==1.0.0
jupyter-client==5.2.4
jupyter-console==6.0.0
jupyter-core==4.4.0
Keras-Applications==1.0.8
Keras-Preprocessing==1.0.8
kiwisolver==1.0.1
Markdown==3.0.1
MarkupSafe==1.1.1
matplotlib==3.0.2
mistune==0.8.4
nbconvert==5.4.1
nbformat==4.4.0
networkx==2.2
notebook==5.7.4
numpy==1.16.1
oauthlib==3.1.0
openapi-spec-validator==0.2.7
opt-einsum==3.1.0
pandas==0.24.1
pandocfilters==1.4.2
parso==0.3.4
pickleshare==0.7.5
Pillow==6.0.0
pip==19.2.3
primo==1.0
prometheus-client==0.6.0
prompt-toolkit==2.0.9
protobuf==3.6.1
pyasn1==0.4.8
pyasn1-modules==0.2.7
Pygments==2.3.1
pykalman==0.9.5
pyparsing==2.3.1
PyQt5==5.12.1
PyQt5-sip==4.19.15
pyrsistent==0.14.11
python-dateutil==2.6.0
pytz==2018.9
pywinpty==0.5.5
pyyaml==5.1
pyzmq==18.0.1
qtconsole==4.4.3
requests==2.21.0
requests-oauthlib==1.3.0
rsa==4.0
scikit-learn==0.21.2
scipy==1.3.3
seaborn==0.9.0
Send2Trash==1.5.0
setuptools==44.0.0
six==1.12.0
sklearn==0.0
swagger-server==1.0.0
swagger-spec-validator==2.4.3
tensorboard==2.1.0
tensorflow==2.0.0
tensorflow-estimator==2.0.1
termcolor==1.1.0
terminado==0.8.1
testpath==0.4.2
tornado==6.0.1
traitlets==4.3.2
typing==3.6.2
urllib3==1.24.3
wcwidth==0.1.7
webencodings==0.5.1
Werkzeug==0.14.1
wheel==0.32.3
widgetsnbextension==3.4.2
wrapt==1.11.2

Next steps

No action items identified. Please copy ALL of the above output, including the lines containing only backticks, into your GitHub issue or comment. Be sure to redact any sensitive information.

About this issue

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

Commits related to this issue

Most upvoted comments

Reporting that I have the same error in the browser. Tensorflow 2.0.0, tensorboard 2.1.0, tested in both firefox and chrome on windows 10. The installation is fresh from yesterday. Errors:

  • In Chrome:

Refused to execute script from ‘http://localhost:16838/index.js’ because its MIME type (‘text/plain’) is not executable, and strict MIME type checking is enabled.

  • In Firefox:

The resource from “http://localhost:16838/index.js” was blocked due to MIME type (“text/plain”) mismatch (X-Content-Type-Options: nosniff)

The error was fixed by switching back to tensorboard 2.0.0.

pip uninstall tensorboard
pip install tensorboard==2.0.0

I have a 10 days old windows instalation and this problem was plaguing me already, so I developed a temporary workaround for people coming here from searching all over the internet that doesn’t involve changing registry (which usually is a better solution, except on my case):

First, check if you have the problem by running cmd.exe and executing the following:

python -c "import mimetypes; print(list(mimetypes.guess_type('index.js')))"

A correct output would be ['application/javascript', None], if you don’t see that, proceed to fix:

mimetypes is usually found at C:\python38\Lib\mimetypes.py, there’s a method guess_type at line 97 (may change depending on your version)

After the comment, add these lines at the start of the function (lines 116 and 117):

        if (isinstance(url, str) and url[-3:] == '.js'):
            return 'application/javascript', None

Then, run the console command again to check if it worked (it should print correctly).

Note: If you have tensorboard running while you fix it, you’ll need to restart the process (tensorboard.exe) to clear its cache.

This was enough for me to transform the 100% blank page to a fully functional page from tensorboard.

1st issue

Ok here are two screenshots. The console indeed shows an error. I googled it and it seems to be a problem that needs a fix in the registry, but I have the needed value missing, so I have to see what I do next. The blank tensorboard page: screen1 The console output: screen2

2nd issue

I tried this and it works now, thanks ! (It is still kinda a bug I would say)

log_dir= ".\\logs\\test\\"+datetime.now().strftime("%Y%m%d-%H%M%S")
tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir=log_dir, histogram_freq=1)

Thank you all for your patience. We’ve gotten our nightlies rolling again.

Please try uninstalling tensorflow and tensorboard and then installing the latest tf-nightly, which will pull in the latest TensorBoard tb-nightly. (Uninstalling first is necessary to prevent Pip from corrupting your installation; using the latest tf-nightly is necessary because the latest tb-nightly depends on nightly-only TensorFlow features.)

On my Windows machine, this suffices to work around the problem.

I’ll leave this open for a bit; please let us know if this works for you or if it doesn’t. We’ll also consider publishing a patch release so that you don’t have to upgrade to the latest TensorFlow nightly.

The issue was fixed by downgrading to tensorboard 2.0!

My Registry at Computer\HKEY_CLASSES_ROOT\.js has a value Content Type set to text/plain. I suppose its about that value. Here is an image of all values there: s1

I previously navigated to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.js because there supposedly should be such a value, but there wasn’t. So I created it and set it to application/javascript and it didn’t solve the issue.

I recently started having this issue with TensorBoard 2.7.0 in Safari. A blank screen appears and nothing I do seems to be fixing it.

The output requested from running the python command is: [‘application/javascript’, None]

Yea, same issue. Current workaround is downgrading to tensorboard-2.0.2. This is definitely an issue with the new release.

I faced the text/plain issue in tensorboard==2.1.1. I uninstalled it and installed tensorboard==2.0.0 and with tensorboard --logdir=.\logs everything is working fine. So the point is the issue is present in 2.1.1

navigated to Computer\HKEY_LOCAL_MACHINE\SOFTWARE\Classes\.js because there supposedly should be such a value, but there wasn’t. So I created it and set it to application/javascript and it didn’t solve the issue.

My understanding is that HKCR is the preferred view because it shows a union of HKLM and some other registry paths, which is why I mentioned HKCR specifically in #3077 and #2771.

if something like visual studio makes tensorboard unusable without changing the register as suspected by @wchargin, I think it probably deserves a fix as the proportion of people using visual studio is non negligible.

We’ve discussed this a bit internally and are probably willing to hack around this on our side, given that it breaks a substantial portion of users, even though the problem isn’t our fault.

I’ve filed #3120 to track this.

@stephanwlee

I do have the mimetype set to test/plain. However, if something like visual studio makes tensorboard unusable without changing the registry as suspected by @wchargin, I think it probably deserves a fix as the proportion of people using visual studio is non negligible.

It works with tensorboard 2.0.0, so a fix could probably be found.

This looks like the same issue as this one: https://github.com/tensorflow/tensorboard/issues/3077. More context here: https://github.com/tensorflow/tensorboard/issues/2771

Can you please check the registry and make sure mimetype for JavaScript is not set to plaintext?