Reputation: 1
I have installed Anaconda on windows 8, after that done with the PyTorch. But while importing torch:
import torch
I'm getting error:
AttributeError Traceback (most recent
call last)
<ipython-input-4-eb42ca6e4af3> in <module>
----> 1 import torch
I:\ProgramData\Anaconda3\lib\site-packages\torch\__init__.py in
<module>
51 from ctypes.wintypes import DWORD, HMODULE
52
---> 53 AddDllDirectory = windll.kernel32.AddDllDirectory
54 AddDllDirectory.restype = DWORD
55 AddDllDirectory.argtypes = [c_wchar_p]
I:\ProgramData\Anaconda3\lib\ctypes\__init__.py in __getattr__(self,
name)
367 if name.startswith('__') and name.endswith('__'):
368 raise AttributeError(name)
--> 369 func = self.__getitem__(name)
370 setattr(self, name, func)
371 return func
I:\ProgramData\Anaconda3\lib\ctypes\__init__.py in __getitem__(self,
name_or_ordinal)
372
373 def __getitem__(self, name_or_ordinal):
--> 374 func = self._FuncPtr((name_or_ordinal, self))
375 if not isinstance(name_or_ordinal, int):
376 func.__name__ = name_or_ordinal
AttributeError: function 'AddDllDirectory' not found
Also when I used the following command it is showing the pytorch in Anaconda command prompt.
(base) C:\Users\rk88>conda list pytorch
# packages in environment at I:\ProgramData\Anaconda3:
# Name Version Build Channel
pytorch 1.0.1 py3.7_cuda100_cudnn7_1
PyTorch
How to resolve this?
Upvotes: 0
Views: 625
Reputation: 254
Try out the below in your anaconda prompt
conda create -n <env_name>python=3.6
conda activate <env_name>
conda install pytorch-cpu torchvision-cpu -c pytorch
If you are using a GPU
conda install pytorch torchvision cudatoolkit=9.0 -c pytorch
Please refer https://pytorch.org/
Upvotes: 1