Pip installation: ModuleNotFoundError: 'mne' is not a package

Hello all.

Please can you assist me with this installation problem?

  • mne version 0.23.0
    -Python version 3.8.10
  • operating system: Linux Ubuntu 20.04

I have installed MNE using pip. I would like to use mne for plotting some graphs, but I get an installation error. In my code:
from mne.viz import plot_connectivity_circle
results in:
ModuleNotFoundError: No module named 'mne.viz'; 'mne' is not a package

I followed the steps here to check the installations (without using anaconda):
python -c "import mne; mne.sys_info()"

with the result:

Platform:      Linux-5.11.0-25-generic-x86_64-with-glibc2.29
Python:        3.8.10 (default, Jun  2 2021, 10:49:15)  [GCC 9.4.0]
Executable:    /usr/bin/python3
CPU:           x86_64: 8 cores
Memory:        15.6 GB
mne:           0.23.0
numpy:         1.21.0 {blas=openblas, lapack=openblas}
scipy:         1.7.0
matplotlib:    3.4.2 {backend=Qt5Agg}
sklearn:       0.24.2
numba:         0.53.1
nibabel:       3.2.1
nilearn:       0.8.0
dipy:          1.4.1
cupy:          Not found
pandas:        1.3.0
mayavi:        4.7.3
pyvista:       0.31.3 {OpenGL 4.5 (Core Profile) Mesa 21.0.3 via Mesa DRI Intel(R) HD Graphics 4600 (HSW GT2)}
vtk:           9.0.3
PyQt5:         5.15.4

The next suggestion is that the “No module named MNE” error suggests that my environment containing MNE-Python is not active and that
conda activate mne
should be used to activate it.

What is the method for activating it if the installation is not done via Anaconda?
I use python for various bioinformatics applications and am reluctant to start working in a new environment at this stage.

Thank you.

MNE-Python works fine without Anaconda. You need to make sure to use the Python interpreter which you used to pip install mne. If python -c "import mne; mne.sys_info()" works for you, you need to use python in your scripts. You can find out where that binary is located with which python.