1

I can't use tensorflow because I get this error message when I try to import tensorflow:

2020-02-28 09:31:24.742077: W tensorflow/stream_executor/platform/default/dso_loader.cc:55] Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found
Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\Maximal\Documents\Python\PyCharm\Projekt1\venv\lib\site-packages\tensorflow\__init__.py", line 98, in <module>
    from tensorflow_core import *
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\Maximal\Documents\Python\PyCharm\Projekt1\venv\lib\site-packages\tensorflow_core\__init__.py", line 40, in <module>
    from tensorflow.python.tools import module_util as _module_util
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\Maximal\Documents\Python\PyCharm\Projekt1\venv\lib\site-packages\tensorflow\__init__.py", line 50, in __getattr__
    module = self._load()
  File "C:\Users\Maximal\Documents\Python\PyCharm\Projekt1\venv\lib\site-packages\tensorflow\__init__.py", line 44, in _load
    module = _importlib.import_module(self.__name__)
  File "C:\Users\Maximal\AppData\Local\Programs\Python\Python36\lib\importlib\__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "C:\Users\Maximal\Documents\Python\PyCharm\Projekt1\venv\lib\site-packages\tensorflow_core\python\__init__.py", line 52, in <module>
    from tensorflow.core.framework.graph_pb2 import *
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\Maximal\Documents\Python\PyCharm\Projekt1\venv\lib\site-packages\tensorflow_core\core\framework\graph_pb2.py", line 7, in <module>
    from google.protobuf import descriptor as _descriptor
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)
  File "C:\Users\Maximal\Documents\Python\PyCharm\Projekt1\venv\lib\site-packages\google\protobuf\descriptor.py", line 47, in <module>
    from google.protobuf.pyext import _message
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2019.3.3\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import
    module = self._system_import(name, *args, **kwargs)

I have Cuda toolkit 10.0 installed and the corresponding version of cuDNN as well as visual studio. At first I got the message:

Could not load dynamic library 'cudart64_101.dll'; dlerror: cudart64_101.dll not found

So I checked the cuda folder and found only a cudart64_100.dll. After some research I found out that cudart_101.dll is part of the version 10.1 of cuda toolkit. So I intalled 10.1 with the corresponding version of cuDNN. But now I get the message:

Could not load dynamic library 'cudart64_100.dll'; dlerror: cudart64_100.dll not found

This makes no sense to me and I didn't find a way to fix this problem. I use the latest version of PyCharm, Python 3.6, Tensorflow-gpu 2.0.0, and Cuda 10.0 and 10.1

Brad Larson
  • 170,088
  • 45
  • 397
  • 571
Daniel
  • 577
  • 4
  • 17
  • 1
    Have you tried using Conda to create the environment? I have had good results with that over pip. – James Feb 28 '20 at 08:46
  • I tried Conda in the first place. It gave me so much trouble creating the environment and installing packages for some reasons I still don't understand that I really don't want to use Conda. That was the reason why I switched from Cona and Jupyter to Pip and PyCharm – Daniel Feb 28 '20 at 08:50
  • 1
    @talonmies cuda is a relevant tag for this question. Why'd you remove it? – Psychotechnopath Feb 28 '20 at 11:42
  • 1
    Because this isn't a CUDA related, on topic question, that's why. A broken tensorflow installation isn't s CUDA programming question – talonmies Feb 28 '20 at 13:56
  • 1
    I do not agree, as the error is clearly caused by a faulty CUDA installation. I don't think the CUDA tag is for CUDA *programming* questions only, it should also be for installation related issues since getting CuDNN and CUDA to work is pretty damn hard, and a lot of people are trying it therefore it is obvious that there are questions about this topic. Or should we create a cuda-installation tag? – Psychotechnopath Feb 28 '20 at 16:01
  • 1
    Installation of CUDA is simple. From an embedded Tegra to deployment on large clusters, it is a simple matter of following the standard NVIDIA instructions. I have done it literally thousands of times. And so have plenty of other people. And tellingly, [SO] almost **never** gets any questions about problems installing CUDA other than those related to tensorflow. And the problems and difficulties are almost uniquely associated with the way tensorflow works and the way it is distributed. So if these are on-topic questions, they are *tensorflow* questions, not CUDA questions – talonmies Mar 04 '20 at 08:13
  • 1
    And I don't think a cuda-installation tag is a solution either. Here is a hypothetical -- "I am trying to mine bitcoin with my GPU and and am getting a cuda library not found error" and "I am trying to import tensorflow and getting a cuda library not found error". I couldn't imagine anyone would agree that a bitcoin miner setup question would be on-topic,and yet at their core, both questions are identical. So if the tensorflow question is on-topic, it is only by virtue of the context. A CUDA installation tag would be a flytrap for all types of poor quality questions we don't want on SO. – talonmies Mar 04 '20 at 08:18
  • @Daniel were you able to solve your problem? – Psychotechnopath Mar 17 '20 at 09:28
  • @Psychotechnopath No unfortunately not. I use a tensorflow container on an AWS. It costs more than my machine but atleast it does work right at the beginning – Daniel Mar 18 '20 at 16:17

1 Answers1

0

At this point I would simply completely remove (e.g. de-install) both CUDA packages (10.0 and 10.1), as it is probably not a good idea to have both at the same time. After de-installing, make sure you check all your folders so that nothing is left.

Then, check whether or not your NVIDIA drivers are up to date.

Closely follow the installation instructions for Windows. Make sure you get a CuDNN package that is compatible with the CUDA version you installed. When you install CuDNN through this link, it will give you a wizard where you can pick different CuDNN versions for different CUDA versions. Pick the one for version 10.1, and place the cudnn64_7.dll, cudnn.h and the cudnn.lib in the right folders of your CUDA installation directory, respectively.

Then, I would go about and create a new conda environment, something like

conda create --name DeepLearning3.6 python=3.6 tensorflow-gpu numpy scipy pandas scikit-learn pandas

will do (Or whatever packages you might need additionally, I usually use these as a starting point but make sure your environment at least includes tensorflow-gpu and numpy). Of course you can also use pip and a venv, both should work that is up to you.

Then, do not forget to point to the right environment in PyCharm ( Ctrl + Alt + S, select the right project interpreter, which in this example would be called DeepLearning3.6). Try to run the script again, it should work now.

Psychotechnopath
  • 2,471
  • 5
  • 26
  • 47