tensorflow / tensorboard

TensorFlow's Visualization Toolkit
Apache License 2.0
6.71k stars 1.66k forks source link

tensorboard crashes with "locale.Error: unsupported locale setting" #1323

Open mikesol opened 6 years ago

mikesol commented 6 years ago

tensorboard 1.9.0 Mac OS High Sierra Python 3.6.5

$ .venv/bin/tensorboard --logdir runs
Traceback (most recent call last):
  File ".venv/bin/tensorboard", line 11, in <module>
    sys.exit(run_main())
  File "/Users/mikesolomon/devel/pytorch-sandbox/.venv/lib/python3.6/site-packages/tensorboard/main.py", line 46, in run_main
    tf.app.run(main)
  File "/Users/mikesolomon/devel/pytorch-sandbox/.venv/lib/python3.6/site-packages/tensorflow/python/platform/app.py", line 125, in run
    _sys.exit(main(argv))
  File "/Users/mikesolomon/devel/pytorch-sandbox/.venv/lib/python3.6/site-packages/tensorboard/main.py", line 55, in main
    default.get_assets_zip_provider())
  File "/Users/mikesolomon/devel/pytorch-sandbox/.venv/lib/python3.6/site-packages/tensorboard/program.py", line 167, in main
    util.setup_logging()
  File "/Users/mikesolomon/devel/pytorch-sandbox/.venv/lib/python3.6/site-packages/tensorboard/util.py", line 50, in setup_logging
    locale.setlocale(locale.LC_ALL, '')
  File "/Users/mikesolomon/devel/pytorch-sandbox/.venv/lib/python3.6/locale.py", line 598, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

commenting out util.setup_logging() makes it work like a charm, but this is kinda hacky. Sorry that I can't contribute a fix, as I'm not exactly sure how the locale affects tensorboard and/or python.

nfelt commented 6 years ago

Hmm, I can't reproduce this in testing against tensorboard 1.9.0 on a High Sierra mac with Python 3.6.5.

Can you check if a plain python3 -c 'import locale; locale.setlocale(locale.LC_ALL, "")' fails for you too? That behavior should be supported by python as the way to set the locale to the user's default settings, and that exact call is even shown as an example here: https://docs.python.org/3/library/locale.html#locale.setlocale

If that call does fail, maybe you're missing a LANG environment variable? If it doesn't fail, is there anything unusual about how you're installing python and/or tensorboard?

HerrMuellerluedenscheid commented 6 years ago

Hey @mikesol

I just encountered the same error when connecting via ssh from my OSX laptop to my gpu workstation running on debian. Turns out that a 'dpkg-reconfigure'solved the issue. Checkout this link on medium for a copy-paste suggestion.

stefan-falk commented 6 years ago

Getting the same issue.

I am able to fix this issue with the help of this answer by running:

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales

Environment


$uname -a
Linux everest10 4.15.0-34-generic #37~16.04.1-Ubuntu SMP Tue Aug 28 10:44:06 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

$pip freeze | grep tensor
tensor2tensor==1.9.0
tensorboard==1.10.0
tensorflow-gpu==1.10.1
filipre commented 6 years ago

for me setting export LC_ALL=C fixed the issue. This might be useful if you do not have sudo rights on the machine.

dosvidos commented 5 years ago

Hit this issue with tensorboard 1.9.0 on MacOS 10.14 Mojave and solved it by export LC_ALL="en_US.UTF-8" export LC_CTYPE="en_US.UTF-8"