ImportError: TensorBoard logging requires TensorBoard version 1.15 or above

knslee07: <p>import torch</p>
<p>import torch.nn as nn</p>
<p>import torch.nn.functional as F</p>
<p>import torch.optim as optim</p>
<p>import torchvision</p>
<p>import torchvision.transforms as transforms</p>
<p>After that, when I type</p>
<p>import torch.utils.tensorboard</p>
<p>This gives the import error. I tried to solve this error by googling here and stackoverflow. I have created a new environment via Conda and installed the stable PyTorch (1.12) and the latest Tensorboard, but does not work for me. Any advice would be greatly appreciated.</p>

ptrblck: <p>I cannot reproduce the issue in PyTorch <code>1.12.0</code> after installing <code>tensorboard</code> via <code>pip install tensorboard</code>. Before installing it I get the expected import error:</p>
<pre><code class="lang-python">ModuleNotFoundError: No module named 'tensorboard'
</code></pre>

knslee07: <p>Hi ptrblck,</p>
<p>Thanks for your reply. I use Anaconda Python, so installed both pt and tb using conda, not pip. Would you suggest installing tb using pip instead? Let me create a new environment and do so. If you could, would you specify python, pt, and tb versions? I would really appreciate it.</p>

knslee07: <p>I created a new Conda env (Python=3.8), installed pt 1.12 and then pip-installed tensorboard (2.9.1). Unfortunately, I still get the same import error.</p>

knslee07: <p>I solved the issue after reading this</p><aside class="onebox githubissue" data-onebox-src="https://github.com/tensorflow/tensorboard/issues/2352">
  <header class="source">

      <a href="https://github.com/tensorflow/tensorboard/issues/2352" target="_blank" rel="noopener nofollow ugc">github.com/tensorflow/tensorboard</a>
  </header>

  <article class="onebox-body">
    <div class="github-row">
  <div class="github-icon-container" title="Issue">
	  <svg width="60" height="60" class="github-icon" viewbox="0 0 14 16" aria-hidden="true"><path d="M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"></path></svg>
  </div>

  <div class="github-info-container">
    <h4>
      <a href="https://github.com/tensorflow/tensorboard/issues/2352" target="_blank" rel="noopener nofollow ugc">Limited tf.compat.v2.summary API due to missing TensorBoard installation</a>
    </h4>

    <div class="github-info">
      <div class="date">
        opened <span class="discourse-local-date" data-format="ll" data-date="2019-06-17" data-time="15:19:50" data-timezone="UTC">03:19PM - 17 Jun 19 UTC</span>
      </div>

        <div class="date">
          closed <span class="discourse-local-date" data-format="ll" data-date="2019-06-18" data-time="16:02:07" data-timezone="UTC">04:02PM - 18 Jun 19 UTC</span>
        </div>

      <div class="user">
        <a href="https://github.com/JCMiles" target="_blank" rel="noopener nofollow ugc">
          <img alt="JCMiles" src="https://avatars.githubusercontent.com/u/33982034?v=4" class="onebox-avatar-inline" width="20" height="20">
          JCMiles
        </a>
      </div>
    </div>

    <div class="labels">
    </div>
  </div>
</div>

  <div class="github-row">
    <p class="github-body-container">I came across this warning after updating to the las nightly release.
Any idea <span class="show-more-container"><a href="" rel="noopener" class="show-more">…</a></span><span class="excerpt hidden">on how to fix it?</span></p>
  </div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>I accidentally had “tensorboard.py” in the folder of the ipynb files that I have been working on. I do not remember whether or when I created it purposely, though. I hope this posting would help others who could be in the same istuation as mine. I spent the two full days doing everything (uninstall, reinstall, create a new env, install using pip, install tb-nightly, etc.). Thanks ptrblck for your reply as well.</p>