Learn how to remove the warning about the dynamic library 'cudart64_110.dll' not being found.

How to fix TensorFlow warning: Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found

After starting with a project that uses machine learning to identify NSFW in pictures, running the demo script in Windows triggered the following output:

2021-01-06 12:14:56.670596: W tensorflow/stream_executor/platform/default/dso_loader.cc:60] 
Could not load dynamic library 'cudart64_110.dll'; dlerror: cudart64_110.dll not found
2021-01-06 12:14:56.670698: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] 
Ignore above cudart dlerror if you do not have a GPU set up on your machine.

The message should be only taken into consideration if the machine has a GPU available, otherwise, you may ignore this warning.

However, if you are sure that you have a GPU installed and it should use the GPU acceleration, you need to install CUDA. You need to be cautious though, in our case, the required CUDA version is 11.x, that's the one that our script is requesting (cudart64_110.dll), so version 11.x is needed. For older scripts that may be outdated, the needed DLL file will be (cudart64_101.dll), so version 10.x is needed.

1. Install CUDA Toolkit

In our case, we have an Nvidia 2060 RTX Super available on the computer, so we may take advantage of the GPU for Machine Learning. You can download the latest version of CUDA from the CUDA Downloads website of Nvidia here, however, if just like in our case, your script requires a specific version of CUDA (older), you need to visit the CUDA Toolkit Archive to download the version that matches your needs here.

The CUDA toolkit is available for both Linux and Windows, in our case, we work on Windows so we may use the installer executable:

CUDA Download Windows

The installer size is about 3GB.

2. Re-open all terminals or restart the computer

By default, the Nvidia CUDA toolkit will automatically register the bin directory to the PATH environment variable, so it won't be recognized right away on any opened terminal. Be sure to close them and open them again to run your Python script to check if the warning doesn't appear anymore. 

Just to be sure, restart the computer.

3. Run the script to test

Now, after running the script that requires TensorFlow to work, you will now see the information message instead of the warning:

2021-01-06 13:32:28.800271: I tensorflow/stream_executor/platform/default/dso_loader.cc:49] 
Successfully opened dynamic library cudart64_110.dll

Troubleshooting

If after the installation of CUDA, neither re-opening the terminal nor restarting the computer removes the warning after running the script, verify if the DLL file exists in the mentioned directory (check as well that the version of the found DLL matches with the one the script needs) at C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v11.2\bin. For this version, the cudart64_110.dll file will exist there.

If the DLL exists, then the problem may be that the bin directory isn't registered in the environment variables of the system. Edit the PATH environment variable and add the absolute directory of CUDA (C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\<your-version>\bin).

Happy coding ❤️!


Senior Software Engineer at Software Medico. Interested in programming since he was 14 years old, Carlos is a self-taught programmer and founder and author of most of the articles at Our Code World.

Sponsors