Cuda only accessed with super privilege (SUDO) including tensorflow, samples

I spent a lot of time thinking cuda is not working on my wsl installed and uninstalled. turned out it only works when I ran sudo. including cuda samples, nvidia-smi, python3

windows 11 (64bit)
WSL 2 latest kernel Ubuntu 20.04
RTX 2070S latest driver 511.74 . tried with cuda 11.6 but installed what supported by tensorflow 2.8 which is 11.2 and 8.1 cudNN

I’m accessing it without docker or anaconda.
anyway to fix this especially for python

Anyone have a solution? I installed new ubuntu from windows store same version 20.04 (this one says 20.04.4) and nvidia-smi can communicate with driver without sudo. what to check for to see difference, I’d rather stay with my original distro as I installed a lot of things and hate to redo everything.

Solved it. apparently there are driver files not sure if left over but there was a conflict that only triggers with normal user.

I used sudo apt remove ^libnvidia-*

and this removed those files:

libcuinj64-10.1 libnvidia-cfg1-510 libnvidia-common-510 libnvidia-compute-510 libnvidia-decode-510
libnvidia-encode-510 libnvidia-extra-510 libnvidia-fbc1-510 libnvidia-gl-510 libnvidia-ml-dev

then immediately I was able to run nvidia-smi and python3 tensorflow without sudo

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.