Depracated Matplotlib v.4.3

Hey!

I commented this on this post but I thought it was due to Matlab.

Running sct_label_utils from terminal also gives me the warning from Matplotlib

sct_label_utils -i $T1File -create-viewer 3 -o c3label.nii.gz

Spinal Cord Toolbox (4.3)

/home/sct_4.3/spinalcordtoolbox/gui/widgets.py:12: MatplotlibDeprecationWarning: 
The matplotlib.backends.backend_qt4agg backend was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
  from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas

Since it’s a warning I can still select c3 from the GUI and everything runs smoothly.

Running ``sct_check_dependencies` gives me

sct_check_dependencies 

--
Spinal Cord Toolbox (4.3)

SCT info:
- version: 4.3
- path: /home/sct_4.3
OS: linux (Linux-5.3.0-62-generic-x86_64-with-debian-buster-sid)
CPU cores: Available: 12, Used by SCT: 12
RAM: MemTotal:       131596272 kB
total usado libre compartido búfer/caché disponible
Memoria:      128511        9071        1654         405      117785      117812
Swap:           975           2         973
Check Python executable.............................[OK]
  Using bundled python 3.6.12 |Anaconda, Inc.| (default, Sep  8 2020, 23:10:56) 
[GCC 7.3.0] at /home/sct_4.3/python/envs/venv_sct/bin/python
Check if torch (1.5.0+cpu) is installed.............[WARNING] (1.6.0 != 1.5.0+cpu mandated version))
Check if torchvision (0.6.0+cpu) is installed.......[WARNING] (0.7.0 != 0.6.0+cpu mandated version))

All the other dependencies are [OK]. Can this difference in torch and torchvision be the reason?

Cheers!

very likely not. However, Your SCT installation seems incorrect. SCT home points to

/home/sct_4.3

while the dependent packages are pointing to:

/home/extop/sct_4.3/python/envs/venv_sct/bin/python

This suggests that you’ve installed SCT two times on the same system, but not at the same location, and the PATH seems to be incorrectly set. This is likely the reason why you have these warnings.

I suggest you install a fresh version, and say “yes” to everything (ie: .bashrc edit).

Cheers,
Julien

Hi Julien,

following what we commented via mail, I installed the latest version, v5.0.0 and I can confirm that this problem persists.

Should I try to download the sct-dev version?

Thanks!

Aran

Hi Aran,

Could you please copy/paste the entire Terminal output showing your installation (starting from the syntax you run), so we can figure out what went wrong? You can do it either from 5.0.0 or from the master branch.

Hi,

i think it’s related to the viewer function/option

extop@:/mnt/aran/testing/001_1$ sct_deepseg_sc -i n4_T1.nii -centerline viewer -c t1

--
Spinal Cord Toolbox (5.0.0)

Config deepseg_sc:
  Centerline algorithm: viewer
  Brain in image: True
  Kernel dimension: 2d
  Contrast: t1
  Threshold: 0.15
Creating temporary folder (/tmp/sct-20201113075251.758061-ygir0amh)
Reorient the image to RPI, if necessary...
Finding the spinal cord centerline...
/home/extop/sct_5.0.0/spinalcordtoolbox/gui/widgets.py:10: MatplotlibDeprecationWarning: 
The matplotlib.backends.backend_qt4agg backend was deprecated in Matplotlib 3.3 and will be removed two minor releases later.
  from matplotlib.backends.backend_qt4agg import FigureCanvasQTAgg as FigureCanvas
Cropping the image around the spinal cord...
Normalizing the intensity...
Segmenting the spinal cord using deep learning on 2D patches...
Traceback (most recent call last):
  File "/home/extop/sct_5.0.0/scripts/sct_deepseg_sc.py", line 208, in <module>
    main()
  File "/home/extop/sct_5.0.0/scripts/sct_deepseg_sc.py", line 192, in main
    threshold_seg=threshold, remove_temp_files=remove_temp_files, verbose=verbose)
  File "/home/extop/sct_5.0.0/spinalcordtoolbox/deepseg_sc/core.py", line 509, in deep_segmentation_spinalcord
    im_in=im_norm_in)
  File "/home/extop/sct_5.0.0/spinalcordtoolbox/deepseg_sc/core.py", line 350, in segment_2d
    seg_model.load_weights(model_fname)
  File "/home/extop/sct_5.0.0/python/envs/venv_sct/lib/python3.6/site-packages/keras/engine/topology.py", line 2656, in load_weights
    f, self.layers, reshape=reshape)
  File "/home/extop/sct_5.0.0/python/envs/venv_sct/lib/python3.6/site-packages/keras/engine/topology.py", line 3328, in load_weights_from_hdf5_group
    original_keras_version = f.attrs['keras_version'].decode('utf8')
AttributeError: 'str' object has no attribute 'decode'
extop@:/mnt/aran/testing/001_1$ 

Probably now it is not the best time to solve this, since the “no attribute” problem also exists.

I’ve checked and i can tell you that using centerline -cnn the program jumps to the second error directly

cheers!

Aran

Aran, the error you reported in your post above (and here: AttributeError: 'str' object has no attribute 'decode' - v5.0.0) is related to a known issue in 5.0.0, which has now been fixed in the master branch and will be available in v5.0.1. You could already try this out if you install SCT from the latest (master) branch.

Once you install master (or 5.0.1 once it is out), could you please copy/paste the entire Terminal output showing your installation.