can not run CUDA sample with GTX1050Ti with Max-Q in ubuntu16.04

After installing cuda10.0 , with command “nvcc -V” I get
“nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Sat_Aug_25_21:08:01_CDT_2018
Cuda compilation tools, release 10.0, V10.0.130”.

While running samples “0_Simple/asyncAPI” and “…/cdpSimplePrint”, I got error
"CUDA error at …/…/common/inc/helper_cuda.h:708 code=35(cudaErrorInsufficientDriver) “cudaGetDeviceCount(&device_count)” "

then I check “nvidia smi” and the output is as follows
"±----------------------------------------------------------------------------+
| NVIDIA-SMI 410.78 Driver Version: 410.78 CUDA Version: N/A |
|-------------------------------±---------------------±---------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
|===============================+======================+======================|
| 0 GeForce GTX 105… Off | 00000000:01:00.0 Off | N/A |
| N/A 41C P8 N/A / N/A | 547MiB / 4042MiB | 12% Default |
±------------------------------±---------------------±---------------------+

±----------------------------------------------------------------------------+
| Processes: GPU Memory |
| GPU PID Type Process name Usage |
|=============================================================================|
| 0 1133 G /usr/lib/xorg/Xorg 322MiB |
| 0 2184 G compiz 185MiB |
| 0 3037 G /usr/lib/firefox/firefox 1MiB |
| 0 8967 G …-token=E22DE5EFE7EEE47F15104BFED2E0C384 37MiB |
±----------------------------------------------------------------------------+
"
Something is wrong since "CUDA Version: N/A "

Also,I’m installing Pytorch and "torch.cuda.available()"got false.

Any Suggestions would be appreciated.

By the way,I installed cuda10.0 with deb(local) and no error reports.

Since there is no reply I just “sudo apt-get purge nvidia*” and “sudo apt-get install cuda” to install again and this time it works.