Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pinned numpy version when the problem is fixed (UMAP not working with Numpy>1.23.5) #215

Open
jo-mueller opened this issue Mar 17, 2023 · 2 comments · Fixed by #219
Labels
bug Something isn't working on hold

Comments

@jo-mueller
Copy link
Collaborator

Hi,

I was just testing some things and noticed that the UMAP was not functional in a fresh devbio-napari installation.

To reproduce

I create some sample data with this code:

import napari
from skimage import data, measure, filters
from napari_clusters_plotter._dimensionality_reduction import DimensionalityReductionWidget

image = data.human_mitosis()

labels = measure.label(image > filters.threshold_otsu(image))
features = measure.regionprops_table(labels, image, properties=('label', 'area', 'eccentricity', 'mean_intensity'))

viewer = napari.Viewer()
viewer.add_image(image, name='human mitosis')
viewer.add_labels(labels, name='human mitosis labels', features=features)


widget = DimensionalityReductionWidget(viewer)
viewer.window.add_dock_widget(widget)

napari.run()

When you select the UMAP algoithm in the dropwdown, al the features in the features list and click on run, nothing happends, whereas tSNE and PCA work. When using the debugger to step through the code, I found that this line throws an error:

result = umap(
    properties_to_reduce,
    n_neigh=n_neighbours,
    n_components=n_components,
    verbose=False,
                )

The error comes from numba: "SystemError: initialization of _internal failed without raising an exception". The error has been described here, with a possible fix being to downgrade numpy to 1.23.5.

Doing mamba install numpy==1.23.5 in my environment fixed the issue for me.

Possible fix

Pinning numpy to `numpy<1.24.0´ could do the trick, although I don't like pinning numpy. he problem has been observed in quite a few packages, though.

@jo-mueller jo-mueller added the bug Something isn't working label Mar 17, 2023
@lazigu lazigu changed the title UMAP not working UMAP not working due to Numpy version Mar 20, 2023
lazigu added a commit that referenced this issue Mar 21, 2023
@lazigu lazigu linked a pull request Mar 21, 2023 that will close this issue
@lazigu lazigu reopened this Mar 21, 2023
@lazigu lazigu changed the title UMAP not working due to Numpy version Remove pinned numpy version (UMAP not working with Numpy>1.23.5) Mar 21, 2023
@lazigu lazigu added the on hold label Mar 21, 2023
@lazigu lazigu changed the title Remove pinned numpy version (UMAP not working with Numpy>1.23.5) Remove pinned numpy version when the problem is fixed (UMAP not working with Numpy>1.23.5) Mar 21, 2023
@ziw-liu
Copy link

ziw-liu commented Sep 13, 2024

Can this pin be removed now? NumPy 1.23 is not supported per SPEC-0 and is incompatible with other packages (e.g. latest zarr).

@Cryaaa
Copy link
Collaborator

Cryaaa commented Sep 17, 2024

hey @ziw-liu,
thanks for catching this, I'm pretty sure that it should not cause a problem but let me test it first! It will definitely be removed in the overhaul that we are working on atm but I thinks it's a good idea to update it in the current version as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working on hold
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants