# Issue getting CuPy to work

**URL:** <https://mne.discourse.group/t/issue-getting-cupy-to-work/4505>\
**Category:** Support & Discussions\
**Tags:** cuda\
**Created:** [March 4, 2022, 8:17am UTC](https://mne.discourse.group/t/issue-getting-cupy-to-work/4505 "2022-03-04T08:17:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Erik](https://avatars.discourse-cdn.com/v4/letter/e/b5ac83/32.png) [@Erik](https://mne.discourse.group/u/Erik)\
**Post date:** [March 4, 2022, 8:17am UTC](https://mne.discourse.group/t/issue-getting-cupy-to-work/4505/1 "2022-03-04T08:17:27Z")

</div>

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](https://mne.tools/stable/install/advanced.html#gpu-acceleration-with-cuda)  
after running

```python
conda install cupy

```

and

```python
mne.sys_info()

```

I get:

```python
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?

```python
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:

```python
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

---

<div class="post-metadata">

**Author:** ![AbdulKaderJaleel](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/abdulkaderjaleel/32/1601_2.png) [@AbdulKaderJaleel](https://mne.discourse.group/u/AbdulKaderJaleel)\
**Post date:** [June 17, 2022, 11:55pm UTC](https://mne.discourse.group/t/issue-getting-cupy-to-work/4505/2 "2022-06-17T23:55:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![richard](https://yyz2.discourse-cdn.com/free1/user_avatar/mne.discourse.group/richard/32/15_2.png) [@richard](https://mne.discourse.group/u/richard)\
**Post date:** [June 18, 2022, 9:14am UTC](https://mne.discourse.group/t/issue-getting-cupy-to-work/4505/3 "2022-06-18T09:14:29Z")

</div>

@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:

```python

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

```

Best wishes  
Richard
