Importing torch error

ssalome: <p>Hi<br>
On importing torch, I’m getting the following error. Can anyone help with this?</p>
<p>File “”, line 14, in <br>
import torch</p>
<p>File “C:\Users\SALOME\Anaconda3\lib\site-packages\torch_<em>init</em>_.py”, line 83, in <br>
<strong>all</strong> += [name for name in dir(_C)</p>
<p>NameError: name ‘_C’ is not defined</p>

theairbend3r: <p>How did you install PyTorch? Using Conda?</p>

ssalome: <p>I installed pytorch using conda<br>
but since this error threw up<br>
I kind of reinstalled it as shown in the figure but the error persisted</p>

ssalome: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/9/a/9a4366ed62507af9c67d62a2159b42000ad9491c.png" data-download-href="https://discuss.pytorch.org/uploads/default/9a4366ed62507af9c67d62a2159b42000ad9491c" title="Screenshot (1391)"><img src="https://discuss.pytorch.org/uploads/default/optimized/3X/9/a/9a4366ed62507af9c67d62a2159b42000ad9491c_2_690x388.png" alt="Screenshot (1391)" data-base62-sha1="m0FWcly7ZBQblRMVvgyMpgQrVLK" width="690" height="388" srcset="https://discuss.pytorch.org/uploads/default/optimized/3X/9/a/9a4366ed62507af9c67d62a2159b42000ad9491c_2_690x388.png, https://discuss.pytorch.org/uploads/default/optimized/3X/9/a/9a4366ed62507af9c67d62a2159b42000ad9491c_2_1035x582.png 1.5x, https://discuss.pytorch.org/uploads/default/optimized/3X/9/a/9a4366ed62507af9c67d62a2159b42000ad9491c_2_1380x776.png 2x" data-dominant-color="969697"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot (1391)</span><span class="informations">1920×1080 258 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>

ssalome: <p>(base) C:\Users\SALOME&gt;python<br>
Python 3.7.1 (default, Dec 10 2018, 22:54:23) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32<br>
Type “help”, “copyright”, “credits” or “license” for more information.<br>
import torch<br>
goes to next line</p>
<p>it runs fine on using the anaconda prompt but throws an error when i import it in Spyder</p>

ssalome: <p>import torch<br>
Traceback (most recent call last):</p>
<p>File “”, line 1, in <br>
import torch</p>
<p>File “C:\Users\SALOME\Anaconda3\lib\site-packages\torch_<em>init</em>_.py”, line 81, in <br>
<strong>all</strong> += [name for name in dir(_C)</p>
<p>NameError: name ‘_C’ is not defined</p>
<p>this is the error i get on spyder</p>

ssalome: <p><div class="lightbox-wrapper"><a class="lightbox" href="https://discuss.pytorch.org/uploads/default/original/3X/0/a/0af83b8d7fa5d881708a7b6e12ef3567f9e1d565.png" data-download-href="https://discuss.pytorch.org/uploads/default/0af83b8d7fa5d881708a7b6e12ef3567f9e1d565" title="Screenshot (1392)"><img src="https://discuss.pytorch.org/uploads/default/original/3X/0/a/0af83b8d7fa5d881708a7b6e12ef3567f9e1d565.png" alt="Screenshot (1392)" data-base62-sha1="1z2BRmCQat9lSAc5mphNKUT6YxT" width="690" height="269" data-dominant-color="F0F0F2"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">Screenshot (1392)</span><span class="informations">708×277 12.1 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div></p>
<p>it points to line 81 in the error in <strong>init</strong>.py</p>

ptrblck: <p>Double post from <a href="https://discuss.pytorch.org/t/loading-and-evaluating-model/71762/17">here</a>.</p>