34

I installed TensorFlow on my MacBook Pro 10.12.5 from source code by steps described here. https://www.tensorflow.org/install/install_sources

TensorFlow itself works well but I cannot run TensorBoard. It seems tensorboard is not installed properly.

When I try running tensorboard --logdir=... it says -bash: tensorboard: command not found. And locate tensorboard returns empty.

Do I need any additional step to install tensorboard?

1
  • This error can also appear if TensorFlow has been installed in a virtualenv or Conda environment and the environemnt is currently not loaded. Commented Oct 21, 2019 at 11:30

7 Answers 7

60

You could call tensorboard as a python module like this:

python3 -m tensorboard.main --logdir=~/my/training/dir 

or add this to your .profile

alias tensorboard='python3 -m tensorboard.main'

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you. That way is easier than search, change directory and run from the specific location.
41

If no other methods work then try this one. It may help you.
1. check the location of Tensorflow

pip show tensorflow 

It will show output something like this.
...
Name: tensorflow
Version: 1.4.0
Location: /home/abc/xy/.local/lib/python2.7/site-packages
...
2. Go to that location you get from the above output.

cd /home/abc/xy/.local/lib/python2.7/site-packages 

There you can see a directory named tensorboard.

cd tensorboard 

3. There must be a file named 'main.py'.
4. Execute the following command to launch the tensorboard.

python main.py --logdir=/path/to/log_file/ 

3 Comments

Just a suggestion: In order to don't execute this procedure more than once. I just added at .bashrc the following command: tensorboard() { cd /usr/local/lib/python2.7/site-packages/tensorboard && python main.py --logdir=/PATH/training } so everytime I wanna execute it I just run the command tensorboard. It worked like a charm btw. Thanks
But what if there is no main.py? That's the case for me on tensorflow 1.14.0 installed with conda.
@Aposhian In that case, uninstall the package and try with pip install tensorboard. It worked for me.
6

If you installed Tensorflow with Virtualenv, then first Check whether you have activated the tensorflow envirnoment or not

If you have activated the tensorflow session then your command prompt will look like this :

tensorflow command prompt

If not, Write the below command and try running tensorboard again.

source ~/tensorflow/bin/activate 

tensorboard running

Comments

4

Run this command:

python3 -m tensorboard.main --logdir=logdir 

To run directory you can use,

Change =logdir to ="dir/TensorFlow" (Directory path)

Comments

3

If you are using pycharm in windows environment this may help: python -m tensorboard.main --logdir=logs

Comments

2

What version of Tensorflow are you running? Older versions don't include Tensorboard.

If you do have a newer version, I see you are using OSX, which apparently caused some problems for other people: https://github.com/tensorflow/tensorflow/issues/2115 Check this page to fix it!

As a MacPorts user, I'm used to running things from out of the path /opt/local/bin. When you install a python package via MacPorts, that's where the executables go --- even if they're just symbolic links to files to a main python repository in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/

pip installs things into the latter directory, but apparently does NOT add the symbolic link to /opt/local/bin

This has never been an issue (or even come up) for me before, because I've only used pip to install (non-executable) packages which load from within python. In conclusion, there is a /opt/local/Library/Frameworks/Python.framework/Versions/2.7/bin/tensorboard

This is a pip / MacPorts-SOP mismatch / user error*, and nothing to do with tensorboard in particular. Please close this issue. Thanks for your help.

*my 'locate' database was in the process of updating but hadn't completed

1 Comment

Thank you for the response. I am using 1.2.1. I read it but it seems different to my current problem.
0

Quickest solution -

echo "alias tensorboard='python3 -m tensorboard.main'" >> ~/.bash_profile

After adding this to your .bash_profile you can use

tensorboard --logdir=/path

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.