[tensorflow] How do I install TensorFlow's tensorboard?

How do I install TensorFlow's tensorboard?

This question is related to tensorflow tensorboard

The answer is


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

It is better not to mix up the virtual environments or perform installation on the root directory. Steps I took for hassle free installation are as below. I used conda for installing all my dependencies instead of pip. I'm answering with extra details, because when I tried to install tensor board and tensor flow on my root env, it messed up.

  • Create a virtual env

    conda create --name my_env python=3.6

  • Activate virtual environment

    source activate my_env

  • Install basic required modules

    conda install pandas

    conda install tensorflow

  • Install tensor board

    conda install -c condo-forge tensor board

Hope that helps


pip install tensorflow.tensorboard  # install tensorboard
pip show tensorflow.tensorboard
# Location: c:\users\<name>\appdata\roaming\python\python35\site-packages
# now just run tensorboard as:
python c:\users\<name>\appdata\roaming\python\python35\site-packages\tensorboard\main.py --logdir=<logidr>

I have a local install of tensorflow 1.15.0 (with tensorboard obviously included) on MacOS.

For me, the path to the relevant file within my user directory is Library/Python/3.7/lib/python/site-packages/tensorboard/main.py. So, which does not work for me, but you have to look for the file named main.py, which is weird since it apparently is named something else for other users.


The pip package you are looking for is tensorflow-tensorboard developed by Google.


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.


Adding this just for the sake of completeness of this question (some questions may get closed as duplicate of this one).

I usually use user mode for pip ie. pip install --user even if instructions assume root mode. That way, my tensorboard installation was in ~/.local/bin/tensorboard, and it was not in my path (which shouldn't be ideal either). So I was not able to access it.

In this case, running

sudo ln -s ~/.local/bin/tensorboard /usr/bin

should fix it.


If you installed TensorFlow using pip, then the location of TensorBoard can be retrieved by issuing the command which tensorboard on the terminal. You can then edit the TensorBoard file, if necessary.


If you're using the anaconda distribution of Python, then simply do:

 $? conda install -c conda-forge tensorboard 

or

 $? conda install -c anaconda tensorboard 

Also, you can have a look at various builds by search the packages repo by:

$? anaconda search -t conda tensorboard

which would list the channels and the corresponding builds, the supported OS, Python versions etc.,


TensorBoard isn't a separate component. TensorBoard comes packaged with TensorFlow.


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.


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

you may have installed tensorflow to virtualenv. activate it and tensorboard command will become available.