Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tensorboard Cannot find .runfiles directory error

I installed tensorboard via pip and when I try to execute tensorboard --logdir= Graph/ I get the following error

Traceback (most recent call last):
  File "/home/pawan/.local/bin/tensorboard", line 152, in <module>
    Main()
  File "/home/pawan/.local/bin/tensorboard", line 102, in Main
    module_space = FindModuleSpace()
  File "/home/pawan/.local/bin/tensorboard", line 83, in FindModuleSpace
    sys.argv[0])
    AssertionError: Cannot find .runfiles directory for /home/pawan/.local/bin/tensorboard

I do which tensorboard and get the following

/home/pawan/.local/bin/tensorboard

thanks in advance.

like image 346
Pawan Nandakishore Avatar asked Mar 04 '17 19:03

Pawan Nandakishore


People also ask

How to run tensorboard in directory in Python 3?

2 Run this command: python3 -m tensorboard.main --logdir=logdir To run directory you can use, Change =logdir to ="dir/TensorFlow" (Directory path) Share Improve this answer Follow answered Jul 25 '20 at 6:49 shoaib21shoaib21 39055 silver badges99 bronze badges Add a comment | 0 Quickest solution -

Where is the tensorboard output folder in Windows?

Windows OS.Tensorboard output folder is created in folder where file.py is located at running.Therefore if you run example.py from Windows Documents folder you may try this in command prompt: tensorboard --logdir=C:\Users\YourName\Documents\output Thanks for contributing an answer to Stack Overflow!

What is logdir in tensorboard?

logdir specifies the directory where TensorBoard will look to find TensorFlow event files that it can display. TensorBoard will recursively walk the directory structure rooted at logdir, looking for .*tfevents.* files. You may also pass a comma separated list of log directories, and TensorBoard will watch each directory.

How to show activity in tensorboard?

Say your data is at 'X:\X\file.x' Go in command line to X:\ first. Then type: tensorboard --logdir=X/ NOT tensorboard --logdir='.X/' Show activity on this post.


2 Answers

It seems they didn't consider that someone would be pip-installing TensorBoard in a user directory. Below is my hack to get it to work:

In the ~/.local/bin/tensorboard script, there's a section that looks like this:

def FindModuleSpace():
  # Follow symlinks, looking for my module space
  stub_filename = os.path.abspath(sys.argv[0])
  while True:
    # Found it?
    module_space = stub_filename + '.runfiles'
    if os.path.isdir(module_space):
      break
    for mod in site.getsitepackages():
      module_space = mod + '/tensorboard/tensorboard' + '.runfiles'
      if os.path.isdir(module_space):
        return module_space

(just above the assertion with the "Cannot find .runfiles directory" error).

The directory it's looking for is

~/.local/lib/python2.7/site-packages/tensorboard/tensorboard.runfiles

which you can discover by running find ~/.local -name '*runfiles*'.

I simply added it to the for loop over directories and all is well:

    for mod in site.getsitepackages() + [os.path.expanduser("~/.local/lib/python2.7/site-packages")]

This is a hack because:

  • I explicitly said python2.7, which might not be the version of Python you're using. Correct it for your case.
  • The use of forward slashes won't work on Windows; a chain of os.path.join would be better.
  • This issue really should be communicated back to the TensorBoard developers. Did you do that?
like image 138
Jim Pivarski Avatar answered Oct 20 '22 00:10

Jim Pivarski


We have to search for the tensorboard folder and run the tensorboard file there.

Search for the tensorflow folder and do the following(My tensorflow folder was there in ~/ itself):

cd ~/tensorflow/lib/python2.7/site-packages/tensorboard

Now run:

python tensorboard --logdir=(the location of your logs path)
like image 33
Shardul Parab Avatar answered Oct 19 '22 23:10

Shardul Parab