Random_device could not be read

Traceback (most recent call last):
** File “test.py”, line 55, in **
** from torchvision.transforms import transforms as T**
** File “/home/manager/env/lib/python3.8/site-packages/torchvision/init.py”, line 4, in **
** from .extension import _HAS_OPS**
** File “/home/manager/env/lib/python3.8/site-packages/torchvision/extension.py”, line 101, in **
** _check_cuda_version()**
** File “/home/manager/env/lib/python3.8/site-packages/torchvision/extension.py”, line 80, in _check_cuda_version**
** _version = torch.ops.torchvision._cuda_version()**
RuntimeError: random_device could not be read

Not sure whats wrong, whenever I try to run my model in a script on cuda device I get this error.
If I import “from torchvision.transforms import transforms as T” in a console it runs fine.

I have tried installing latest to historic versions of pytorch but no luck.

My system has ubuntu 20.04 installed. I am also using tensorflow along with pytorch in the script. I have started facing this issue after upgrading to 20.04 from 16.04.

This would point to a broken installation in the other environment you are using (I don’t know how you are executing the script in the failing case).