DeprecationWarning: distutils Version classes are deprecated warning when using nilearn plot

Hi @mmagnuski

I tried replicating MNE Source localization with equivalent current dipole (ECD) fit tutorial on my computer, but was not able to get figure for Dipole location in MNI space.


subject = 'sample'
mni_pos = dip.to_mni(subject=subject, trans=fname_trans,
                     subjects_dir=subjects_dir)

mri_pos = dip.to_mri(subject=subject, trans=fname_trans,
                     subjects_dir=subjects_dir)

# Find an anatomical label for the best fitted dipole
best_dip_idx = dip.gof.argmax()
label = dip.to_volume_labels(fname_trans, subject=subject,
                             subjects_dir=subjects_dir,
                             aseg='aparc.a2009s+aseg')[best_dip_idx]

# Draw dipole position on MRI scan and add anatomical label from parcellation
t1_fname = op.join(subjects_dir, subject, 'mri', 'T1.mgz')
fig_T1 = plot_anat(t1_fname, cut_coords=mri_pos[0],
                   title=f'Dipole location: {label}')

try:
    template = load_mni152_template(resolution=1)
except TypeError:  # in nilearn < 0.8.1 this did not exist
    template = load_mni152_template()
fig_template = plot_anat(template, cut_coords=mni_pos[0],
                         title='Dipole loc. (MNI Space)')

The error said:








C:\Users\sxb2391\Anaconda3\envs\mne\lib\site-packages\mne\utils\check.py:92: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  LooseVersion(library.__version__) < LooseVersion(min_version):
C:\Users\sxb2391\Anaconda3\envs\mne\lib\site-packages\mne\utils\check.py:92: DeprecationWarning: distutils Version classes are deprecated. Use packaging.version instead.
  LooseVersion(library.__version__) < LooseVersion(min_version):

How can this be fixed? I tried doing fig_T1.show() , fig_T1.show() but none of them worked

Hello @Rekha, these are just warnings and not errors, and for now can safely be ignored.

1 Like

nilearn fixed this back in January so updating the nilearn version should make the warning go away.

1 Like