Nvidia :unable to recognize any device drivers

I have the same laptop the best way to go about it is Switch to 'Switchable Graphics' in BIOS make sure secure boot is disabled then boot into Ubuntu and follow these steps

  1. Purge all nvidia related packages following command will list all nvidia packages and you have to purge all of them

    sudo dpkg -l | grep nvidia

  2. Install recommended driver using

    sudo ubuntu-drivers autoinstall

  3. Select Nvida in prime settings

    sudo prime-select nvidia

  4. Reboot and select 'Discrete Graphics' in your BIOS