nipy / nipype

Workflows and interfaces for neuroimaging packages
https://nipype.readthedocs.org/en/latest/
Other
751 stars 530 forks source link

Leftover Python 2 construct (cmp) is still used #3631

Closed yarikoptic closed 9 months ago

yarikoptic commented 9 months ago

Got pointed to it by a student at pbs@dartmouth -- boils down to still remaining delayed import of deprecated (removed in python 3) cmp:

❯ git describe --tags
1.8.6-118-g42302ed75

❯ git grep -p 'import cmp'
nipype/interfaces/cmtk/parcellation.py=def create_annot_label(subject_id, subjects_dir, fs_dir, parcellation_name):
nipype/interfaces/cmtk/parcellation.py:    import cmp
nipype/interfaces/cmtk/parcellation.py=def create_roi(subject_id, subjects_dir, fs_dir, parcellation_name, dilation):
nipype/interfaces/cmtk/parcellation.py:    import cmp
nipype/interfaces/cmtk/parcellation.py=def create_wm_mask(subject_id, subjects_dir, fs_dir, parcellation_name):
nipype/interfaces/cmtk/parcellation.py:    import cmp
effigies commented 9 months ago

Isn't cmp in this context "CMTK Parcellation"?

Python 2 cmp was a builtin, not imported.

Camilo-Castelblanco commented 9 months ago

Hi @yarikoptic @effigies thank you for your comments. I asked the question. For context, I have a Freesurfer output and am trying to compute the Lausanne parcellations using parcellate = cmtk.Parcellate(). The issue is that in the parcellation.py code, cmp is imported and used throughout (see example below). However, I am having issues using Python versions >3.0

image

I am unsure @effigies by what you mean in that cmp was a builtin. Thank you for your help.

effigies commented 9 months ago

cmp in this context seems to be http://www.cmp.cmtk.org/, which includes a Python 2 library. You will not be able to use it with Python 3.

The Python builtin cmp was a function that you could run in Python 2. It does not exist in Python 3, but you also wouldn't import it.