0

I have installed pytorch with command:

conda install pytorch torchvision cudatoolkit=10.2 -c pytorch -y

Python complains regarding line import torch with message:

Could not find module 'C:\ProgramData\Anaconda3\envs\edx\lib\site-packages\torch\lib\caffe2_nvrtc.dll' (or one of its dependencies). Try using the full path with constructor syntax

This directory contains library caffe2_nvrtc.dll. What might be wrong and how to fix this error?

3
  • 64-bit vs 32-bit mismatch? Commented May 26, 2020 at 12:06
  • My Python is 3.8.3 64 bit. How to check Pytorch? Commented May 26, 2020 at 12:14
  • Is that the entire error output? Can you share the contents of the environment? Commented May 28, 2020 at 5:11

3 Answers 3

1

I faced the same problem. If your OS is Windows then I would recommend using Anaconda and installing pytorch in separate conda environment. Quick solution is to search for nvcuda.dll file on google and download this file. If you are running the code on Jupyter notebook the output will give you the complete path of the 'lib' folder of conda environment. By default it is 'C:\Users\YourUserName\anaconda3\envs\mera_beta\Lib\site-packages\torch\lib'. Go this directory and paste the file in this folder. Rerun your code. Hopefully it will run.

Sign up to request clarification or add additional context in comments.

Comments

1

I just had the same problem. It worked for me when I installed the PyTorch CPU only version. Use conda install pytorch torchvision cpuonly -c pytorch which can be found here

Comments

0

Do you have a GPU on your machine? Try installing without CUDA and that fixed it for me.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.