Skip to content

Instantly share code, notes, and snippets.

View akaanirban's full-sized avatar
🏠
Working from home

Anirban Das akaanirban

🏠
Working from home
  • Capital One
  • San Mateo, CA
View GitHub Profile
@akaanirban
akaanirban / install_cudnn.md
Last active December 4, 2020 18:50
How to get rid of the `Could not load dynamic library 'libcudnn.so.7'; dlerror: libcudnn.so.7: cannot open shared object file: No such file or directory;` problem

Basically this error is due to the fact that libcudnn*.so files are not present in the installation path of cuda. It appears that on installing the cuda toolkit, the cudnn files are not by default installed. Now the installation path of cuda varies in different machines/installations for example it can be /usr/local/cuda/lib64 , but also in some cases can be /usr/lib/cuda/lib64/ etc.

  1. Anyway, where ever the installation path maybe, you can find it out by doing whereis cuda.
  2. Once that is done, then you need to download the specific cuda version of cuDNN Library for Linux from Nvidias website: https://developer.nvidia.com/cudnn . Here in the following I download and install cuDNN for cuda 10.1.

Version 7 (libcudnn.so.7) can be directly downloaded as

wget https://developer.download.nvidia.com/compute/machine-learning/cudnn/secure/7.6.5.32/Production/10.1_20191031/cudnn-10.1-linux-x64-v7.6.5.32.tgz?m2hqDRAYQiO6rrilch-TIU9xtf877-R5k-aUI4GXEShM3FY3Sap9Ua4wTj5LUxyQAED2lrSf2NSWhuEn-tQCvEDghZ4f
@akaanirban
akaanirban / gist:621e63237e63bb169126b537d7a1d979
Last active March 22, 2022 00:40
Install pyTorch in Raspberry Pi 4 (or any other)

Edit 04/11/2021: This gist is quite old now. The current version of PyTorch is 1.8.1, which is miles ahead of version 1.0.1 that I was trying to install when I wrote this gist. Therefore some of the instructions may not apply, or some dependencies may have changed or bugs taken care of. I do not currently have a Raspberry Pi to verify unfortunately. Please proceed with caution. Further, there are may others who have shared their fixes, and direct links to their wheels down in the comments. Cheers !

Install the prerequisites (the last one for numpy):

sudo apt install libopenblas-dev libblas-dev m4 cmake cython python3-yaml libatlas-base-dev

Increase the swap size:

  • Stop the swap : sudo dphys-swapfile swapoff
  • Modify the size of the swap by editing as root the following file : /etc/dphys-swapfile. Modify the valiable CONF_SWAPSIZE and change its value to CONF_SWAPSIZE=2048