Score:1

TensorFlow GPU could not load cuda libraries on PyCharm

cn flag

I'm having a hard time trying to get the things work with TensorFlow, nvidia and PyCharm. Basically, I had followed the pre/post steps during installation process and ended up with:

eric@xps:~$ gcc --version
gcc (Ubuntu 10.3.0-1ubuntu1) 10.3.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

eric@xps:~$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Mon_Nov_30_19:08:53_PST_2020
Cuda compilation tools, release 11.2, V11.2.67
Build cuda_11.2.r11.2/compiler.29373293_0
eric@xps:~$ nvidia-smi
Sun Jul 11 15:01:09 2021       
+---------------------------------------------+
| NVIDIA-SMI 465.31       Driver Version: 465.31       CUDA Version: 11.3     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  NVIDIA GeForce ...  Off  | 00000000:01:00.0 Off |                  N/A |
| N/A   47C    P8    N/A /  N/A |    374MiB /  2004MiB |      8%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+---------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|    0   N/A  N/A      1582      G   /usr/lib/xorg/Xorg                158MiB |
|    0   N/A  N/A      1932      G   /usr/bin/gnome-shell               62MiB |
|    0   N/A  N/A      3612      G   ...cef_18.log --shared-files        1MiB |
|    0   N/A  N/A      3666      G   /usr/lib/firefox/firefox          146MiB |
+---------------------------------------------+

However, whenever I try to run from PyCharm:

import tensorflow as tf
print(tf.__version__)

I got this error:

W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory

Whatsoever, If I do start a python console and do the same the result obtained is:

eric@xps:~$ python3
Python 3.9.5 (default, May 11 2021, 08:20:37) 
[GCC 10.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import tensorflow as tf
2021-07-11 15:06:36.919852: I tensorflow/stream_executor/platform/default/dso_loader.cc:53] Successfully opened dynamic library libcudart.so.11.0
>>> print(tf.__version__)
2.5.0
>>> 

So, I'm wondering what could else should I configure to have it work properly. I've added cuda to PATH:

eric@xps:~$ echo $PATH
/home/eric/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/lib/cuda/bin

I've setup the Python Interpreter as the one detected by PyCharm which is /usr/bin/python

But still not success in such a simple task. Any tip/help will be highly appreciated :)

Also looked at: https://forums.developer.nvidia.com/t/path-ld-library-path/48080

Additional info:

eric@xps:~$ lspci |grep -E "VGA|3D"
00:02.0 VGA compatible controller: Intel Corporation HD Graphics 530 (rev 06)
01:00.0 3D controller: NVIDIA Corporation GM107M [GeForce GTX 960M] (rev a2)
PyCharm 2021.1.3 (Professional Edition)
Build #PY-211.7628.24, built on June 30, 2021
Licensed to Eric Rodriguez
Subscription is active until January 18, 2022.
For educational use only.
Runtime version: 11.0.11+9-b1341.60 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
Linux 5.11.0-7620-generic
GC: G1 Young Generation, G1 Old Generation
Memory: 2048M
Cores: 8

Current Desktop: pop:GNOME


eric@xps:~$ hostnamectl
   Static hostname: xps
         Icon name: computer-laptop
           Chassis: laptop
  Operating System: Pop!_OS 21.04
            Kernel: Linux 5.11.0-7620-generic
      Architecture: x86-64
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.