Issue getting CuPy to work

I am trying to get CuPy to work, however I am having issues.
(Bear in mind I am recently self taught everthing I know about coding, so I might be missing obvious steps or context)
Following the guide on Advanced setup — MNE 1.0.3 documentation
after running

conda install cupy

and

mne.sys_info()

I get:

mne.sys_info()
Platform:       Windows-10-10.0.19041-SP0
Python:         3.8.8 (default, Apr 13 2021, 15:08:03) [MSC v.1916 64 bit (AMD64)]
Executable:     C:\Users\Erik\anaconda3\python.exe
CPU:            Intel64 Family 6 Model 94 Stepping 3, GenuineIntel: 4 cores
Memory:         15.9 GB

mne:            0.24.1
numpy:          1.20.1 {blas=mkl_rt, lapack=mkl_rt}
scipy:          1.6.2
matplotlib:     3.3.4 {backend=module://ipykernel.pylab.backend_inline}

sklearn:        0.24.1
numba:          0.53.1
nibabel:        Not found
nilearn:        Not found
dipy:           Not found
cupy:           8.3.0
pandas:         1.2.4
mayavi:         Not found
pyvista:        Not found
pyvistaqt:      Not found
ipyvtklink:     Not found
vtk:            Not found
PyQt5:          5.9.2
ipympl:         Not found
mne_qt_browser: Not found
pooch:          Not found

However I can’t figure out how to run the following step. Am I understanding it correctly that I should run this in my anaconda prompt?

MNE_USE_CUDA=true python -c "import mne; mne.cuda.init_cuda(verbose=True)"
'MNE_USE_CUDA' is not recognized as an internal or external command,
operable program or batch file.

Running the following also returns an error:

pytest mne/tests/test_filter.py -k cuda
ERROR: file or directory not found: mne/tests/test_filter.py

I am betting there is something obvious I am missing?

  • MNE version: e.g. 0.24.0
  • operating system: Windows 10

Hi Erik, I am stuck with this issue now. Did you manage to fix this?

@Erik The problem here is that you’re working on windows, and this “environment variable prefixing” is a Unix shell thing.

On windows, you need to turn this into a two-liner, where first you export the variable and then you run Python

Something like:


set MNE_USE_CUDA=true 
python -c "import mne; mne.cuda.init_cuda(verbose=True)"

Best wishes
Richard