mne-tools / mne-python

MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python
https://mne.tools
BSD 3-Clause "New" or "Revised" License
2.72k stars 1.32k forks source link

Old mne version with installation from conda-forge on linux-64 #10577

Closed marsipu closed 2 years ago

marsipu commented 2 years ago

Describe the bug

The installation of mne via conda commands on Linux doesn't install the newest version.

Steps to reproduce

conda create --name mne --channel conda-forge mne

Expected result

currently mne==1.0.2

Actual result

mne==0.23.4

mne sys_info

Platform:      Linux-5.13.0-40-generic-x86_64-with-glibc2.31
Python:        3.9.12 | packaged by conda-forge | (main, Mar 24 2022, 23:25:59)  [GCC 10.3.0]
Executable:    <home>/miniconda3/envs/mne/bin/python
CPU:           x86_64: 32 cores
Memory:        31.3 GB

mne:           0.23.4
numpy:         1.22.3 {blas=NO_ATLAS_INFO, lapack=lapack}
scipy:         1.8.0
matplotlib:    3.5.1 {backend=QtAgg}

sklearn:       1.0.2
numba:         Not found
nibabel:       3.2.2
nilearn:       0.9.1
dipy:          1.5.0
cupy:          Not found
pandas:        1.4.2
mayavi:        4.7.4
pyvista:       0.34.0 {pyvistaqt=0.9.0, OpenGL 4.6.0 NVIDIA 470.103.01 via Quadro K5200/PCIe/SSE2}
vtk:           
PyQt5:         5.9.2
marsipu commented 2 years ago

It seems as if mne is installed from linux-64 and not noarch. grafik

But when I try conda create --n mne -c conda-forge/noarch mne, the version is even lower (mne==0.16.2)

larsoner commented 2 years ago

That is very strange, is your conda up to date?

marsipu commented 2 years ago

Yes, conda==4.12.0. I also tried conda clean --all, but that didn't help.

hoechenberger commented 2 years ago

This was reported on the forum too and I'm planning to look into it this weekend.

https://mne.discourse.group/t/mne-1-0-in-conda-forge/4743

hoechenberger commented 2 years ago

@marsipu A temporary workaround is to explicitly specify the package version, as in

conda create --name mne --channel conda-forge mne=1.0.2
hoechenberger commented 2 years ago

@marsipu Could you please try to create the environment with mamba instead of conda and see if you run into the same issue?

hoechenberger commented 2 years ago

@marsipu Could you please share with me the output of

conda info

and

conda config --show channel_priority

Thanks!

hoechenberger commented 2 years ago

@larsoner Could you try the following to see if you'll run into the same issue?

mamba create -n mne-installation-test
mamba activate mne-installation-test
echo "channel_priority: flexible\nchannels:\n  - main" > $CONDA_PREFIX/.condarc
mamba create --name mne-test --channel conda-forge mne

The idea is to create a situation that resembles the default behavior of conda on systems where Miniconda or Anaconda was installed – I've been using Miniforge and Mambaforge` for years now so things behave differently there.

My guess is that the channel_priority is the problem. By default, it's flexible, and if the user didn't use Miniconda or Miniforge, the main channels are part of the "package source mix", and there might be situations where the solver finds it easier to pull in certain dependencies from main than from conda-forge, with odd consequences.

The conda-forge docs explicitly mention that one should set channel_priority to strict, probably to avoid exactly these issues.

marsipu commented 2 years ago

conda info

     active environment : base
    active env location : /home/martins/miniconda3
            shell level : 1
       user config file : /home/martins/.condarc
 populated config files : 
          conda version : 4.12.0
    conda-build version : not installed
         python version : 3.7.7.final.0
       virtual packages : __cuda=11.4=0
                          __linux=5.13.0=0
                          __glibc=2.31=0
                          __unix=0=0
                          __archspec=1=x86_64
       base environment : /home/martins/miniconda3  (writable)
      conda av data dir : /home/martins/miniconda3/etc/conda
  conda av metadata url : None
           channel URLs : https://repo.anaconda.com/pkgs/main/linux-64
                          https://repo.anaconda.com/pkgs/main/noarch
                          https://repo.anaconda.com/pkgs/r/linux-64
                          https://repo.anaconda.com/pkgs/r/noarch
          package cache : /home/martins/miniconda3/pkgs
                          /home/martins/.conda/pkgs
       envs directories : /home/martins/miniconda3/envs
                          /home/martins/.conda/envs
               platform : linux-64
             user-agent : conda/4.12.0 requests/2.27.1 CPython/3.7.7 Linux/5.13.0-40-generic ubuntu/20.04.4 glibc/2.31
                UID:GID : 1001:1001
             netrc file : None
           offline mode : False
marsipu commented 2 years ago

conda config --show channel_priority

channel-priority: flexible

hoechenberger commented 2 years ago

@marsipu Can you run:

conda config --set channel_priority strict

and try again to create the MNE environment?

marsipu commented 2 years ago

Yes, this seems to solve the problem. But it seems that the default value for channel_priority in conda is flexible. Should we warn about this in the docs?

mne sys_info Platform: Linux-5.13.0-40-generic-x86_64-with-glibc2.31 Python: 3.10.4 | packaged by conda-forge | (main, Mar 24 2022, 17:38:57) [GCC 10.3.0] Executable: /miniconda3/envs/mne/bin/python3.10 CPU: x86_64: 32 cores Memory: 31.3 GB mne: 1.0.2 numpy: 1.21.6 {blas=NO_ATLAS_INFO, lapack=lapack} scipy: 1.8.0 matplotlib: 3.5.1 {backend=QtAgg} sklearn: 1.0.2 numba: 0.55.1 nibabel: 3.2.2 nilearn: 0.9.1 dipy: 1.5.0 cupy: Not found pandas: 1.4.2 pyvista: 0.34.0 {OpenGL 4.5.0 NVIDIA 470.103.01 via Quadro K5200/PCIe/SSE2} pyvistaqt: 0.9.0 ipyvtklink: 0.2.2 vtk: 9.1.0 PyQt5: 5.12.3 ipympl: Not found pooch: v1.6.0 mne_bids: Not found mne_nirs: Not found mne_features: Not found mne_qt_browser: 0.3.0 mne_connectivity: Not found
hoechenberger commented 2 years ago

Ok, cool, thanks for checking!

The default will change to strict in conda 5.0, but I'm not sure when this will be released. So until then, we should amend the docs, yes.