Cannot install nvidia graphics driver 440 on Ubuntu 18.04 LTS on thinkpad using Nvidia 1650 Max-Q mobile GPU

Hi.
I’m trying to install an nvidia graphics driver but have failed on numerous attempts. FYI, I have the Secure boot disabled. I’ve also removed files where the /etc/modprobe.d and /lib/modprobe.d nvidia was blacklisted.

I’ve attemped to install the drivers -440, -435, -430, -418 using
sudo apt install nvidia-driver-XXX

and when failed, removed the installations by
sudo apt purge nvidia*

I have been going through this for two days now and feel very lost. I would highly appreciate help!!

  1. OS
    No LSB modules are available.
    Distributor ID: Ubuntu
    Description: Ubuntu 18.04.4 LTS
    Release: 18.04
    Codename: bionic

  2. Graphics Card
    lspci -nn | grep ‘[03’

00:02.0 VGA compatible controller [0300]: Intel Corporation UHD Graphics 630 (Mobile) [8086:3e9b] (rev 02)
01:00.0 VGA compatible controller [0300]: NVIDIA Corporation TU117M [GeForce GTX 1650 Mobile / Max-Q] [10de:1f91] (rev a1)

  1. ubuntu-drivers devices
    == /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==
    modalias : pci:v000010DEd00001F91sv000017AAsd0000229Fbc03sc00i00
    vendor : NVIDIA Corporation
    driver : nvidia-driver-435 - distro non-free
    driver : nvidia-driver-440 - third-party free recommended
    driver : xserver-xorg-video-nouveau - distro free builtin

== /sys/devices/pci0000:00/0000:00:1d.6/0000:52:00.0 ==
modalias : pci:v00008086d00002723sv00008086sd00000080bc02sc80i00
vendor : Intel Corporation
manual_install: True
driver : backport-iwlwifi-dkms - distro free

  1. nvidia-smi (error message after attempted installation)
    NVIDIA-SMI has failed because it couldn’t communicate with the NVIDIA driver. Make sure that the latest NVIDIA driver is installed and running.

Let me know if there’s any information you need. Thanks!!

I’ve followed the instructions in this link

upgraded by gcc and g++ to -9.2.X version and it worked!! hope this helps.