1

I am getting desperate with Chainer because I'm not able to use it with GPU for about a week now. The error I am getting: RuntimeError: CUDA environment is not correctly set up (see https://github.com/chainer/chainer#installation).No module named 'cupy.util'

Code to reproduce:

import chainer
chainer.cuda.to_gpu([0, 0])

Output of chainer.backends.cuda.available is False.

Working on Ubuntu 20.04 (I know, it is not the one from the recommended on Chainer's docs) inside WSL2. CUDA drivers 11.0. Output of nvcc -V:

nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2020 NVIDIA Corporation
Built on Wed_Jul_22_19:09:09_PDT_2020
Cuda compilation tools, release 11.0, V11.0.221
Build cuda_11.0_bu.TC445_37.28845127_0

CUDA samples compile and work properly inside WSL2.

According to pip freeze, cupy-cuda110 is installed within an (activated) virtual environment (but not detected, it seems). Chainer version 7.7.0 is installed.

Any ideas how to fix it?

Solution from https://github.com/chainer/chainer/issues/8582 did not seem to do the trick for me.

talonmies
  • 70,661
  • 34
  • 192
  • 269
Valeria
  • 1,508
  • 4
  • 20
  • 44

1 Answers1

1

The error message is very clear. Just change L69 of backends/cuda.py:

from cupy.util import PerformanceWarning as _PerformanceWarning

to

from cupy._util import PerformanceWarning as _PerformanceWarning

along with the solution from #8582, everything will work just fine.

H3NT41
  • 81
  • 1
  • 4
  • How is this clear from the error message? I'm genuinely curious, cause this solution (changing `cupy.util` to `cupy._utils`) also solved a similar issue I had, but my error message just said `No module named 'cupy.util'`. – roygbiv Feb 21 '23 at 15:18
  • 1
    @roygbiv since it used to work before, something must have changed in cupy v8. A simple search in GitHub leads me to this [commit](https://github.com/cupy/cupy/commit/add37ef6a993a7e1509e04c62c2ff37aa20fe2e2), and everything is now perfectly clear. – H3NT41 Mar 15 '23 at 12:35