Problems installing NVIDIA driver for GTX 1050 on Ubuntu 16.04

Hi,
if I try installing the NVIDIA driver with the .run file from the nvidia website, i get the following error message when executing: the distribution-provided pre-install script failed!
If I still continue the installation, I get into a login-loop where I am not able to login.
If I try to install the driver with apt-get install, the installation is successfull, but after restarting the computer, I get into the login-loop again. Can anyone help me?

Please upgrade your HWE stack:

sudo apt-get install --install-recommends linux-generic-hwe-16.04 xserver-xorg-hwe-16.04

https://wiki.ubuntu.com/Kernel/LTSEnablementStack
If that doesn’t resolve the issue, please run nvidia-bug-report.sh as root and attach the resulting .gz file to your post. Hovering the mouse over an existing post of yours will reveal a paperclip icon.
https://devtalk.nvidia.com/default/topic/1043347/announcements/attaching-files-to-forum-topics-posts/

Thank you very much! That actually resolved my problem!