Reputation: 939
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?
Upvotes: 24
Views: 64327
Reputation: 3008
In October 2023 the VSCode integration still didn't work for me out of the box, when attempting to use it via SSH on a remote machine with Conda.
I either got a prompt for Tensorboard not installed
or a timeout after 60 seconds. If I selected "Yes" when I got Tensorboard not installed, I got an installation process started, at the end of which I got the message All requested packages are already installed
. I followed all the VSCode GitHub bug issues on this issue, and they all end up pointing out to this PR: github.com/microsoft/vscode-python/pull/19592 which actually didn't fix the issue for me.
tl;dr: what I did to run Tensorboard via SSH on my Ubuntu VM was:
Check if you can start tensorboard manually running tensorboard --logdir= .
from terminal without getting a command not found
or similar error.
1.1 If not, check if you tensorboard installation has a main.py
file, as per this SO post:
pip show tensorflow
cd
to the location printed on screen.cd tensorboard
to go in the main code folderls
and verify if there is a main.py
file.1.2 If no main.py
is present, probably the installation got corrupted. Make sure you don't have the deprecated tensorflow-tensorboard
installed:
pip uninstall tensorflow-tensorboard
,pip uninstall tensorboard
pip install tensorboard
Here I got an error stating that it couldn't find GLIBCXX_3.4.29
. I followed this SO answer to get it installed.
After 2, I finally could run Tensorboard, even via the VSCode integration.
Upvotes: 1
Reputation: 773
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:
Command Palette
-> Python Select Interpreter
command palette
-> Python: Launch TensorBoard
References:
1: https://code.visualstudio.com/docs/python/environments#_work-with-python-interpreters
2: https://pypi.org/project/tensorflow-tensorboard/
Upvotes: 8
Reputation: 316
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:
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.
Upvotes: 30
Reputation: 21
I had the same issue, I was able to visualize tensorboard by entering http://localhost:6006
in the browser.
Screenshot of Tensorboard
Upvotes: 2
Reputation: 101
You can use this
tensorboard --logdir=data/ --host localhost --port 8888
Upvotes: 8