Install specific CUDA version on Ubuntu 18.04

Hi all,

My code is having problems with the latest CUDA release (10.1.243) and I therefore want to downgrade back to 10.1.168. The problem I am having doing this is indeed similar to a a previous post (https://devtalk.nvidia.com/default/topic/1030495/install-a-specific-cuda-version-for-ubuntu-16-04/), yet does not seem to work here.

What I am generally trying to do is uninstall all existing packages, then download the old deb file and reinstall the old version. The problem is that even after the following steps (especially line 10), Ubuntu keeps installing the 10.1.243 version instead of 10.1.168.

My steps are the follwing:

sudo apt-get --purge -y remove 'cuda*'
sudo apt-get --purge -y remove 'nvidia*'
sudo apt autoremove -y
sudo apt-get clean

reboot

sudo dpkg -i cuda-repo-ubuntu1804_10.1.168-1_amd64.deb
sudo apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/7fa2af80.pub
sudo apt-get install cuda-10-1=10.1.168-1

Is there something else I have to do to make Ubuntu install that specific version or am I missing something else? Thanks for your help!

Update:
It appears that when choosing a specific version for meta-packages like cuda-10-1, it only changes the version of the meta-package but not of all dependencies. All packages belonging to the meta-package are thus installed in the default version which is 10.1.243. The same does for instance also apply when choosing the cuda-drivers meta-package.