Nvidia-smi not working with ubuntu 18.04

nvidia-smi error with ubuntu 18.04:
NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

When I do ubuntu-drivers devices, I get:
== /sys/devices/pci0000:00/0000:00:1c.4/0000:03:00.0 ==
modalias : pci:v000010DEd00000DE2sv00001458sd0000368Cbc03sc00i00
vendor : NVIDIA Corporation
model : GF108 [GeForce GT 420]
driver : nvidia-340 - third-party free
driver : nvidia-304 - third-party free
driver : nvidia-driver-390 - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin

== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
modalias : pci:v000010DEd00001028sv000010DEsd00001015bc03sc02i00
vendor : NVIDIA Corporation
model : GK110GL [Tesla K20m]
manual_install: True
driver : nvidia-driver-460 - distro non-free
driver : nvidia-driver-450-server - distro non-free
driver : nvidia-driver-470 - distro non-free
driver : nvidia-driver-470-server - distro non-free recommended
driver : nvidia-driver-418-server - distro non-free
driver : nvidia-driver-460-server - distro non-free
driver : xserver-xorg-video-nouveau - distro free builtin

It might be because of the 2 different types of GPUs that the computer might have.
Any help is appreciated!