Unable to use cuda on pytorch in anaconda

i installed pytorch using anaconda using the conda command on python 2.7
i am getting this error when trying to use print torch.rand(3,3).cuda()

Traceback (most recent call last):

File “”, line 1, in
File “/home/tensor/anaconda3/envs/python2/lib/python2.7/site-packages/torch/_utils.py”, line 66, in cuda
return new_type(self.size()).copy
(self, async)
File “/home/tensor/anaconda3/envs/python2/lib/python2.7/site-packages/torch/cuda/init.py”, line 266, in _lazy_new
File “/home/tensor/anaconda3/envs/python2/lib/python2.7/site-packages/torch/cuda/init.py”, line 84, in _lazy_init
File “/home/tensor/anaconda3/envs/python2/lib/python2.7/site-packages/torch/cuda/init.py”, line 58, in _check_driver
Found no NVIDIA driver on your system. Please check that you
have an NVIDIA GPU and installed a driver from

i have a nvidia 840 m with the latest driers installed

hmm, that’s definitely weird.

What’s the output of the nvidia-smi command on your machine?

command not found is the error, even nvidia-settings says

ERROR: Error querying enabled displays on GPU 0 (Missing Extension).

nvidia-settings could not find the registry key file. This file should
have been installed along with this driver at
/usr/share/nvidia/nvidia-application-profiles-key-documentation. The
application profiles will continue to work, but values cannot be
prepopulated or validated, and will not be listed in the help text.
Please see the README for possible values and descriptions.

Maybe you have an incomplete driver installation. Try reinstalling the driver. nvidia-smi should be present usually.