nipreps / niworkflows

Common workflows for MRI (anatomical, functional, diffusion, etc)
https://www.nipreps.org/niworkflows
Apache License 2.0
87 stars 52 forks source link

svgutils 0.3.2 breaks compose_view (possibly others) #595

Closed effigies closed 3 years ago

effigies commented 3 years ago

MRIQC release 0.16.0 was held up by a CI failure:

  File "/usr/local/miniconda/lib/python3.7/site-packages/niworkflows/viz/utils.py", line 360, in compose_view
    fig = SVGFigure(width, heights[:nsvgs].sum())
  File "/usr/local/miniconda/lib/python3.7/site-packages/svgutils/transform.py", line 242, in __init__
    self._width = width.value
AttributeError: 'numpy.int64' object has no attribute 'value'

Opened an issue at https://github.com/btel/svg_utils/issues/57 to see what the correct fix is, but the short term fix is to pin svgutils 0.3.1.

effigies commented 3 years ago

Looks like the fix for 0.3.2 is to use Unit objects provided by svgutils: https://github.com/btel/svg_utils/pull/58/files#diff-e8aa6d811244eff36276b6f2042973e5b5b30db429f997288e45bf0ce5be717dR55

mgxd commented 3 years ago

After the fix btel/svg_utils#58, there is still a piece that needs to be updated within our code:

The FigureElement.moveto scale parameter has been extracted into scale_x and scale_y parameters. I think we should be fine just adjusting scale_x and leaving scale_y as None.

EDIT: relevant line https://github.com/nipreps/niworkflows/blob/b631029c828baedcbeececb5b5fb4c92904a7e30/niworkflows/viz/utils.py#L396

effigies commented 3 years ago

Agree, though we'll then need to depend on >=0.3.3 or try/except to allow a wider range of versions. Frustrating that they broke their API on a patch release.

oesteban commented 3 years ago

We hit this problem in dMRIPrep already (https://github.com/nipreps/dmriprep/pull/144#issuecomment-756409550), I don't know what @slimnsour did, whether he reported this or not.

EDIT: I see you guys have all figured out :D