wrong version installed with conda

Hi, first of all Happy New year to everyone and may you find health and success in this new year.
Secondly, thank you very much for this amazing tool which is mne.

I ran into some issues recently with the plotting:
when I do raw.plot(), the signal is plotted into a matplotlib window instead of the nice MNE BROWSER. I spent a lot of time trying to troubleshoot by checking:

  • If the right matplotlib backend is called (Qt5Agg)
  • If I have the right Qt version (Qt5)
  • If the right PyQt is installed (PyQt5)
  • If I have mne-qt-browser is installed (checked through the conda verbose during the install)
  • When using iPython I tryied the magic commands %gui qt, %matplotlib qt
  • Tried different text editors (VIM, VS code)

and I ended up reinstalling mne, miniconda, Qt etc…
But nothing

When I run raw.plot() I can see this message:
<ipython-input-3-41bfa3401378>:199: RuntimeWarning: Setting non-standard config type: "MNE_BROWSER_BACKEND" mne.set_config('MNE_BROWSER_BACKEND', 'qt5')

I noticed that everytime I installed mne with miniconda or mamba when I run mne --version it shows MNE 0.23.dev0 .

And when I run mne.sys_info() I get:

Platform: Windows-10-10.0.19044-SP0
Python: 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:16:33) [MSC v.1929 64 bit (AMD64)]
Executable: c:\Users\Sam19\miniconda3\envs\mne\python.exe
CPU: Intel64 Family 6 Model 85 Stepping 7, GenuineIntel: 20 cores
Memory: 63.7 GB

mne: 0.23.dev0
numpy: 1.23.5 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy: 1.10.0
matplotlib: 3.6.2 {backend=Qt5Agg}

sklearn: 1.2.0
numba: 0.56.4
nibabel: 4.0.2
nilearn: 0.10.0
dipy: 1.5.0
cupy: Not found
pandas: 1.5.2
mayavi: Not found
pyvista: 0.37.0 {pyvistaqt=0.9.0, OpenGL 4.5.0 NVIDIA 522.06 via Quadro RTX 4000/PCIe/SSE2}
vtk:
PyQt5: 5.15.7

as you can see I want MNE version 1.3.0 but I get the version 0.23.
So I presumed that mne-qt-browser was not implemented in that version and that’s why I can’t plot correctly with mne-qt-browser.

The question is, how can I get the right version when installling mne with mamba or miniconda?

Thanks in advance

Hello,

Indeed, the qt browser was added in 1.0.
For the RuntimeWarning, the correct variable is 'qt'. Thus, you should use mne.set_config('MNE_BROWSER_BACKEND', 'qt') if you want to set the browser to the qt backend in the configuration.

That said it’s definitely strange that you are showing the info for a 0.23.dev0 version. I would recommend to install MNE in a fresh conda environment:

conda create --strict-channel-priority --channel=conda-forge --name=mne mne

Or with mamba:

conda install --channel=conda-forge mamba
mamba create --override-channels --channel=conda-forge --name=mne mne

Or you can use the installers that will setup an environment with most packages you need.

Note: I am not a heavy user of either conda or mamba, so I might have made a mistake in the commands.

1 Like

Hello @Sam54000, what’s the output of:

import mne
print(mne.__file__)

Thanks!

Thanks for your answers
Yes I did re install several times by using either:
conda create --strict-channel-priority --channel=conda-forge --name=mne mne

or

conda install --channel=conda-forge mamba
mamba create --override-channels --channel=conda-forge --name=mne mne

I ran the command

import mne 
print(mne.__file__)

Here is the output:

C:\Users\<username>\AppData\Roaming\Python\Python310\site-packages\mne\__init__.py

But in site-packages I also have a folder mne-0.23.dev0.dist-info. Should I remove it?

This is what I suspected. This directory was probably created when you ran pip install --user some time ago.

This is a huge issue in Python. I’ve seen these “user installs” cause nothing but trouble – the symptom is always like what you’re describing here: inexplicable versions of a package suddenly surface. Unfortunately, until not-too-long-ago, this was the recommended way to install MNE and related packages (as per official docs).

In the MNE-Python standalone installers, we actually actively disable these “user packages”. This can be achieved by setting the environment variable PYTHONNOUSERSITE to 1.

To do that, open your terminal / Anaconda prompt, activate your MNE environment, and type:

conda env config vars set PYTHONNOUSERSITE=1

The next time you activate the MNE environment, the variable will be automatically set, and the packages found in ...AppData\Roaming\ will be ignored – and your conda-installed MNE-Python will be used instead.

Best wishes,
Richard

2 Likes

Yes, I remember installing mne with pip some time ago.

I followed your instructions, it worked, great!
Thanks so much for your help!

I am marking this as solved

1 Like

Just to be clear: using pip should normally give the expected results. The problem only arises when you use (or have previously used) the --user switch when running pip.

Glad to hear it’s working for you now!

Richard