when importing pytorch microsoft visual C++ Redistributable is not installed

Viewed 8193

I work in a windows machine with GPU. I have installed pytorch in a conda environment with

conda install pytorch torchvision cudatoolkit=10.1 -c pytorch

then I run python and inside of python I do import torch and I get this error

           Python 3.6.10 |Anaconda, Inc.| (default, May  7 2020, 19:46:08) [MSC v.1916 64 bit (AMD64)] on win32
                    Type "help", "copyright", "credits" or "license" for more information.     
>>> import torch       
Microsoft Visual C++ Redistributable is not installed, this may lead to the DLL load failure.  
It can be downloaded at https://aka.ms/vs/16/release/vc_redist.x64.exe                                 
Traceback (most recent call last):                                                                                       
 File "<stdin>", line 1, in <module>                                                                                     
File "C:\Users\aliag\anaconda3\envs\pytorchPractice\lib\site-packages\torch\__init__.py", line 127, in <module>           
raise err                                                                                                           
OSError: [WinError 126] 指定されたモジュールが見つかりません。 
Error loading "C:\Users\aliag\anaconda3\envs\pytorchPractice\lib\site-packages\torch\lib\asmjit.dll" 
or one of its dependencies.                                                 
>>> 

How can I correct this error?

1 Answers

Get the Microsoft Visual C++ Redistributable installer from the link in the error, in this case is this. Run the installer and launch again your shell with conda configured when finished

Related