nvcc not found on Ubuntu Server

The error I get when I login to my Ubuntu Server and try to compile using nvcc is:

The program ‘nvcc’ is currently not installed. You can install it by typing:
apt install nvidia-cuda-toolkit

Whereas when I compile using nvcc directly on Ubuntu Desktop, the code compiles normally.

Can anybody help me with this issue?

You’ll need to set your PATH and LD_LIBRARY_PATH variables as described in the linux installation guide.

I have set that but it is still not working.

Oh it’s fixed now. Thanks!