Cuda with tensorflow issue cannot open shared object file: No such file or directory


So I installed cuda like this:
sudo apt-get purge -y cuda
sudo apt-get purge -y libcudnn6
sudo apt-get purge -y libcudnn6-dev
sudo dpkg -i cuda-repo-ubuntu1604_9.0.176-1_amd64.deb
sudo dpkg -i libcudnn7_7.0.5.15-1+cuda9.0_amd64.deb
sudo dpkg -i libcudnn7-dev_7.0.5.15-1+cuda9.0_amd64.deb
sudo dpkg -i libnccl2_2.1.4-1+cuda9.0_amd64.deb
sudo dpkg -i libnccl-dev_2.1.4-1+cuda9.0_amd64.deb
sudo apt-get update
sudo apt-get install -y cuda=9.0.176-1
sudo apt-get install libcudnn7-dev
sudo apt-get install libnccl-dev

Which works temporarily and I am able to run my code. But then I get this error:

tensorflow.python.framework.errors_impl.NotFoundError: cannot open shared object file: No such file or directory

I thought it was a one time issue and reinstalled multiple times and it always breaks. Could you please show what is wrong about my installation?

install the cuda-9-0 package

I have. I reinstall it, it works temporarily and then breaks again.

have you set your LD_LIBRARY_PATH variable correctly?

It was set for an older version. Thank you!