How do I install TensorFlow's tensorboard?
Solution 1
The steps to install Tensorflow are here: https://www.tensorflow.org/install/
For example, on Linux for CPU-only (no GPU), you would type this command:
pip install -U pip
pip install tensorflow
Since TensorFlow depends on TensorBoard, running the following command should not be necessary:
pip install tensorboard
Solution 2
Try typing which tensorboard
in your terminal. It should exist if you installed with pip
as mentioned in the tensorboard README (although the documentation doesn't tell you that you can now launch tensorboard without doing anything else).
You need to give it a log directory. If you are in the directory where you saved your graph, you can launch it from your terminal with something like:
tensorboard --logdir .
or more generally:
tensorboard --logdir /path/to/log/directory
for any log directory.
Then open your favorite web browser and type in localhost:6006
to connect.
That should get you started. As for logging anything useful in your training process, you need to use the TensorFlow Summary API. You can also use the TensorBoard
callback in Keras.
Solution 3
If your Tensorflow install is located here:
/usr/local/lib/python2.7/dist-packages/tensorflow
then the python command to launch Tensorboard is:
$ python /usr/local/lib/python2.7/dist-packages/tensorflow/tensorboard/tensorboard.py --logdir=/home/user/Documents/.../logdir
The installation from pip allows you to use:
$ tensorboard --logdir=/home/user/Documents/.../logdir
Solution 4
TensorBoard isn't a separate component. TensorBoard comes packaged with TensorFlow.
Solution 5
It may be helpful to make an alias for it.
Install and find your tensorboard location:
pip install tensorboard
pip show tensorboard
Add the following alias in .bashrc:
alias tensorboard='python pathShownByPip/tensorboard/main.py'
Open another terminal or run exec bash.
For Windows users, cd into pathShownByPip\tensorboard
and run python main.py
from there.
For Python 3.x, use pip3
instead of pip
, and don't forget to use python3
in the alias.
Related videos on Youtube
Alex_M
Updated on July 08, 2022Comments
-
Alex_M almost 2 years
How do I install TensorFlow's tensorboard?
-
Charlie Parker over 2 yearsyou can do:
conda install -y -c conda-forge tensorboard
-
-
Alex_M over 8 yearshave you tried it. i wasn't able to run tensorboard. now i have git-cloned the tensorflow repo and i'm trying to build bazel since this seems to be a requirement
-
Mike Harris over 8 years@Alex_M Yes, that worked for me. TensorBoard was installed as part of Tensorflow, and I was able to run it using
python .local/lib/python2.7/site-packages/tensorflow/tensorboard/tensorboard.py --logdir=tmp
-
dandelion over 8 years@Alex_M: Any time you're able to run TensorFlow you should be able to run TensorBoard as well; if you pip installed then you can just use the
tensorboard
command, but running the tensorboard.py file under tensorflow/tensorboard should work as well. -
Alex_M over 8 yearstotally curious. since i was running linux in a vm on windows, i organized today a ssd and installed linux on bare-metal. i pip installed tensorflow and I'm now not able to run tensorboard any more. "hich tensorboard" returns nothing
-
Dave about 8 yearsThe path has changed slightly since this answer was written. It is now:
tensorflow/tensorboard/backend/tensorboard.py
(also,pip show tensorflow
can be used to get the base directory for a particular machine) -
xjcl over 5 yearsThe man page for
conda install
says that the-c
flag is ignored, what is up with that? -
wchargin about 5 yearsThis answer used to be accurate, but no longer is: the package is now simply called
tensorboard
, andtensorflow-tensorboard
is defunct. -
becko about 4 years@xjcl If you type
man conda install
that doesn't open a man page for conda. -
djstrong about 4 yearsNow, it is separate:
pip install tensorboard
-
Vichoko over 3 yearsI find this answer misleading as
tensorflow
isn't needed fortensorboard
. Many other ML libraries usetensorboard
for logging so I wouldn't statetensorflow
as a requirement fortensorboard
. The correct and simpler response would be directly install tensorboard either with conda or pip, skipping the install oftensorflow
. -
Charlie Parker over 2 yearswhat about with conda?
-
Charlie Parker over 2 yearsyou can do:
conda install -y -c conda-forge tensorboard
-
Charlie Parker over 2 years@xjcl it's definitively not ignored in my experience. That is odd.
-c conda-forge
seems to work most of the time for me. -
xjcl over 2 years@CharlieParker I might have opened the man page for
install
by accident, apologies