How to resolve TensorFlow 2.0 Error – Could not load dynamic library ‘cudart64_100.dll’

Recently I came across an issue while building ANN with TensorFlow 2.0, where IntelliJ complained about not being able to load the dynamic library ‘cudart64_100.dll’. The below instructions outline the approach for fixing the issue and would apply also to errors that refer to other NVIDIA GPU Computing Toolkit dynamic libraries, such as cufft64_100.dll, cufftw64_100.dll, cuinj64_100.dll, nppig64_100.dll,  nppim64_100.dll, nppist64_100.dll, nppisu64_100.dll, nppitc64_100.dll, npps64_100.dll, nppif64_100.dll, nppia164_100.dll or nppicc64_100.dll, all of which are part of the older version of CUDA platform for general computing on graphical processing units (GPUs) developed by NVIDIA .

This is what the error looks like in my IDE:

Googling for the library name, I found that it’s part of CUDA Toolkit (GPU Computing SDK) and recalled that I installed TensorFlow 2.0 with GPU support (pip3 install –user tensorflow-gpu) instead of the regular version of TensorFlow (pip3 install tensorflow); and that might just be the source of my problem. Of course, the primary reason for installing TensorFlow-GPU release was to use my NVIDIA GPU. What I did not realize was that my graphics card does not automatically come pre-installed with CUDA Toolkit which includes all the libraries and developer drivers required by the TensorFlow GPU computing engine.

That said, if you don’t care about using GPU optimized TensorFlow, then the simple fix is to uninstall TensorFlow-GPU and install TensorFlow without GPU support. But that’s not what I wanted to do, as I still planned on using GPU to assist with neural network calculations in Python.

 


SIMPLE INSTRUCTIONS

To fix the issue, either:

  • Install CUDA from September 2018, which comes with ‘cudart64_100.dll’ and other 32 bit *100.dlls and 64 bit *100 libraries.

Or, if you want future support:

  • Install the latest ‘NVIDIA GPU Computing Toolkit’.
  • However, because the newest version of the CUDA library is ‘cudart64_101.dll’ and TensorFlow 2.0 requires the older ‘cudart64_100.dll’, also install the CUDA from September 2018.
  • Then copy ‘cudart64_100.dll’ library from the old install of CUDA to the new one.
  • Or just download the library from the file attached further below and copy it into your last CUDA installation directory in program files.

STEP BY STEP INSTRUCTIONS

The easiest way to find out if your computer is missing CUDA (on Windows) is to look at C:\Program Files\ directory. If you see the ‘NVIDIA GPU Computing Toolkit’ directory in program files, you are likely just missing the specific library. If you’re missing the entire directory (C:\Program Files\NVIDIA GPU Computing Toolkit), then you will need to install CUDA from scratch.

This is how I resolved the issue on my PC:

First, I installed the CUDA Toolkit. You can download the latest from https://developer.nvidia.com/cuda-toolkit-archive. In mid-Oct 2019 (as of writing this article), the newest release is the CUDA Toolkit 10.1 update2 (Aug 2019) version from https://developer.nvidia.com/cuda-downloads?target_os=Windows&target_arch=x86_64. I selected my OS and the network installer type (note: you must be logged in to NVIDIA to be able to download CUDA):

Then, I ran the installer executable:

As you can see above, NVIDIA will create the ‘NVIDIA GPU Computing Toolkit’ in C:\Program Files.

However, this did not resolve my issue. Only later I realized, that that is because the latest version of TensorFlow requires cudart64_100.dll and the newest version of CUDA comes with a newer version of the library: cudart64_101.dll, as can be seen in this screenshot:

So, to resolve this issue fast, you must either uninstall the latest and install an older version of CUDA, such as the CUDA Toolkit 10.0 (Sept 2018), which has the cudart64_100.dll, or, do what I did.

Leave the latest NVIDIA CUDA version installed, and download the cudart64_100.dll from my site: cudart64_100.dll.zip (I have manually extracted from CUDA Toolkit 10.0 Sept 2018 toolkit to save you some time). Once downloaded, unzip the file into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.1\bin (or whatever is the latest version of CUDA on your disk).

When done, you’ll see two files on your disk: cudart64_100.dll and cudart64_101.dll:

That resolved the issue, with an added benefit of being future proof, because if TensorFlow-GPU starts to support cudart64_101.dll, it’ll be placed on your system already.

Now, reboot your computer, and your problem should be resolved. The TensorFlow Stream Executor default dso loader will report that cudart64_100.dll dynamic library was successfully opened:

And I can see CUDA utilized in Windows task manager:

 

Leave me a note if the above instructions helped you.

Facebook Comments