Closed GenevieveBuckley closed 1 year ago
@sofroniewn, as you are the author of this example, maybe it is possible to take a look at it?
We were both surprised when it gave an error, and thought that was something the CI should have caught.
I assume the check at the top for nilearn
prevents this from running on CI? It doesn't show up in the logs.
Edit: looking at the workflow and stuff further—yes. This example is skipped: https://github.com/napari/napari/blob/3ec4be1ae8eee50ab4912ba87981261cc94c075f/napari/_tests/test_examples.py#L23-L33
Yes it's skipped on the CI, but my point is that the example fails when you do install nilearn
and try to run it.
The examples test was moved to separate job. So maybe someone could review list of skipped examples and check if some of them could be enabled.
@GenevieveBuckley the only solution is that some core dev will spend time to fix it.
Hi, just in case, I checked the example and seems like the error comes from nilearn
being incompatible with numpy
1.24.x. If you run the example with numpy
1.23.x it works:
Also, with numpy
1.23.x a VisibleDeprecationWarning
message appears which points to the line inside nilearn
where the error occurs when using numpy
1.24.x :
\site-packages\nilearn\surface\surface.py:684: VisibleDeprecationWarning: Creating an ndarray from ragged nested sequences (which is a list-or-tuple of lists-or-tuples-or ndarrays with different lengths or shapes) is deprecated. If you meant to do this, you must specify 'dtype=object' when creating the ndarray.
return np.asarray([arr.data for arr in gifti_img.darrays]).T.squeeze()
So I guess either being sure to use numpy < 1.24.x or adding the dtype=object
kwarg at the line mentioned inside nilearn
should fix the example
If I'm parsing this correctly, this is an upstream issue in nilearn
and not a bug in napari/the example?
FYI nilearn does have a PR open that could fix this error: https://github.com/nilearn/nilearn/pull/3644
🐛 Bug
The napari example script
surface_timeseries_.py
returns an error when it is run.To Reproduce
Steps to reproduce the behavior:
nilearn
into your python environmentsurface_timeseries_.py
from here:python surface_timeseries_.py
Error message:
``` python surface_timeseries_.py Dataset created in /Users/genevieb/nilearn_data/nki_enhanced_surface Downloading data from https://www.nitrc.org/frs/download.php/8470/pheno_nki_nilearn.csv ... ...done. (1 seconds, 0 min) Downloading data from https://www.nitrc.org/frs/download.php/8261/A00028185_rh_preprocessed_fsaverage5_fwhm6.gii ... Downloaded 42377216 of 42412120 bytes (99.9%, 0.1s remaining) ...done. (100 seconds, 1 min) Downloading data from https://www.nitrc.org/frs/download.php/8260/A00028185_lh_preprocessed_fsaverage5_fwhm6.gii ... Downloaded 41697280 of 42402060 bytes (98.3%, 1.3s remaining) ...done. (81 seconds, 1 min) Traceback (most recent call last): File "/Users/genevieb/Documents/GitHub/napari/examples/surface_timeseries_.py", line 24, inExpected behavior
I expected the example script to run without an error, and to display some timeseries surface data in napari.
Environment
napari: 0.4.13.dev917+g54c1dbf8 Platform: macOS-12.3.1-arm64-arm-64bit System: MacOS 12.3.1 Python: 3.10.8 | packaged by conda-forge | (main, Nov 22 2022, 08:25:29) [Clang 14.0.6 ] Qt: 5.15.6 PyQt5: 5.15.7 NumPy: 1.24.2 SciPy: 1.10.1 Dask: 2023.1.0 VisPy: 0.12.1 magicgui: 0.6.1 superqt: unknown in-n-out: 0.1.6 app-model: 0.1.1 npe2: 0.6.2
OpenGL:
Screens:
Settings path:
Additional context
Juan and I were talking about how to colour the vertices of a mesh according to some property, and he suggested I look at this example. We were both surprised when it gave an error, and thought that was something the CI should have caught.