Skip to content
This repository was archived by the owner on Mar 25, 2020. It is now read-only.
This repository was archived by the owner on Mar 25, 2020. It is now read-only.

There might be a bug for users installing tensorboard via anaconda #36

@hehaodele

Description

@hehaodele

I am using Anaconda as my python environment. To install tensorboard, I simply followed the instruction

pip install tensorboard

However when I run

$ tensorboard --logdir=path/to/logs

I get

  File "/home/haohe/anaconda2/bin/tensorboard", line 161, in <module>
    Main()
  File "/home/haohe/anaconda2/bin/tensorboard", line 111, in Main
    module_space = FindModuleSpace()
  File "/home/haohe/anaconda2/bin/tensorboard", line 92, in FindModuleSpace
    sys.argv[0])

Then I come to stackoverflow, find very useful information on (http://stackoverflow.com/questions/42600499/tensorboard-cannot-find-runfiles-directory-error/43174814)

By the recommandation there, I run

 find /home/haohe/anaconda2/ -name '*runfiles*'

which returns,

/home/haohe/anaconda2/lib/python2.7/site-packages/tensorboard/tensorboard.runfiles

Then I come to the /home/haohe/anaconda2/bin folder to check the tensorboard script, where I looked into the FindModuleSpace function and get

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
    package_path = site.getsitepackages()
    # In case this instance is a string
    if not isinstance(package_path, list):
      package_path = [package_path]
    user_path = site.getusersitepackages()
    if not isinstance(user_path, list):
      user_path = [user_path]
    package_path.extend(user_path)
    for mod in package_path:
      module_space = mod + '/tensorboard/tensorboard' + '.runfiles'
    if os.path.isdir(module_space):
      return module_space

    runfiles_pattern = "(.*\.runfiles)/.*"
    if IsWindows():
      runfiles_pattern = "(.*\.runfiles)\\.*"
    matchobj = re.match(runfiles_pattern, os.path.abspath(sys.argv[0]))
    if matchobj:
      module_space = matchobj.group(1)
      break

    raise AssertionError('Cannot find .runfiles directory for %s' %
                         sys.argv[0])
  return module_space

I notice one weird thing is this piece of code,

    for mod in package_path:
      module_space = mod + '/tensorboard/tensorboard' + '.runfiles'
    if os.path.isdir(module_space):
      return module_space

It seems the only the last item in package_path will be checked. Thus I changed the code into

    #print package_path # to check the package_path
    for mod in package_path:
      module_space = mod + '/tensorboard/tensorboard' + '.runfiles'
      if os.path.isdir(module_space):
        return module_space

Then I make it work.

So I really would like to know, do I miss something when I install tensorboard or it might be something need to be fixed.

Thanks for your patience to read my experience.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions