CUDA 9.1 uninstall causes "cannot locate kernel sources" error at reinstall

I used the run-file method to install nvidia drivers (without openGL) and cuda-toolkit on Ubuntu 16.04 and was able to compile and run the examples and tests without problems. Then I uninstalled using

$ sudo /usr/local/cuda-9.1/bin/uninstall_cuda_9.1.pl
$ sudo /usr/bin/nvidia-uninstall

Now I’m trying to reinstall but get “cannot locate kernel sources” error. Any idea what may cause this problem? Kernel and gcc are not the recommended ones but did not cause problems initially.

$ uname -r 
4.13.0-36-generic
$ gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.9) 5.4.0 20160609