'How to run tensorboard in vscode?

Whenever I try to run tensorboard in a jupyter notebook within visual studio code with this command tensorbard --logdir=runs, I get the message Launching TensorBoard.... However, Tensorboard never launches. Sometimes I also get an error message.

Any ideas on how to launch tensorboard within vscode?

EDIT:

I also tried running slightly optimized commands

%load_ext tensorboard
%tensorboard --logdir runs

but this only shows the message Launching Tensorboard... eternally.

Same result with

%reload_ext tensorboard
%tensorboard --logdir runs --host localhost --port 8888

Is there any tensorboard extension that embeds tensorboard into a cell output?



Solution 1:[1]

VS Code and the Python extension now has TensorBoard integrated in it in its latest release!

https://devblogs.microsoft.com/python/python-in-visual-studio-code-february-2021-release/

To start a TensorBoard session from VSC:

  1. Open the command palette (Ctrl/Cmd + Shift + P)
  2. Search for the command “Python: Launch TensorBoard” and press enter.
  3. You will be able to select the folder where your TensorBoard log files are located. By default, the current working directory will be used.

VSCode will then open a new tab with TensorBoard and its lifecycle will be managed by VS Code as well. This means that to kill the TensorBoard process all you have to do is close the TensorBoard tab.

Solution 2:[2]

You can use this

tensorboard --logdir=data/ --host localhost --port 8888

Solution 3:[3]

Although the answer provided by @Jeffrey is correct, it lacks an important detail. Since I am not able to edit the post from @Jeffrey, I am rewriting my answer here.

You have to select python interpreter from Command Palette -> Python Select Interpreter as mentioned here BEFORE using the 3 steps mentioned in the Jeffrey's post.

Additionally, VS Code might ask you to install tensorboard and torch-tb-profiler before third step mentioned in Jeffrey's post. You could install it by clicking on the prompt or manually.

Hence, the comprehensive steps will be as follows:

  1. Select appropriate python interpreter: Command Palette -> Python Select Interpreter
  2. Start Tensorboard: command palette -> Python: Launch TensorBoard
  3. (For first time) Install Tensorboard and torch-tb-profiler: You can do it by just clicking on vs code prompt or manually inside the select python interpreter.
  4. Folder selection: Select the folder where your TensorBoard log files are stored. By default, the current directory opened in vs code file will be used.

References:
1: https://code.visualstudio.com/docs/python/environments#_work-with-python-interpreters
2: https://pypi.org/project/tensorflow-tensorboard/

Solution 4:[4]

I had the same issue, I was able to visualize tensorboard by entering http://localhost:6006 in the browser.

Screenshot of Tensorboard

Solution 5:[5]

Try the following: tensorboard --logdir=runs

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nebel22
Solution 2 Sabito 錆兎 stands with Ukraine
Solution 3 Dan
Solution 4 Sabito 錆兎 stands with Ukraine
Solution 5 AMI