Tag Archives: UserWarning: CUDA initialization: CUDA unknown error

[Solved] UserWarning: CUDA initialization: CUDA unknown error

An accident caused by a school power failure.

UserWarning: CUDA initialization: CUDA unknown error – this may be due
to an incorrectly set up environment, e.g. changing env variable CUDA_VISIBLE_DEVICES after program start. Setting the available devices to be zero. (Triggered internally at /pytorch/c10/cuda/CUDAFunctions.cpp:109.) return torch._C._cuda_getDeviceCount() > 0

Solution.
I did reinstall pytorch and then restarted.
But today’s hiccups were more than that.

UnknownError: Failed to get convolution algorithm. This is probably because cuDNN failed to initialize, so try looking to see if a warning log message was printed above.

Solution:

conda install -c anaconda keras-gpu

But there are new mistakes:

ImportError: cannot import name ‘keras_ export’

I’m completely stuck and can only remove it:

conda list

Viewing all the packages configured in our CONDA environment, we can see that the following three packages are associated with tensorflow:

there is no way. We can only uninstall one package and reconfigure the environment:

pip uninstall ‘Package Name’