MouseLand / cellpose

a generalist algorithm for cellular segmentation with human-in-the-loop capabilities
https://www.cellpose.org/
BSD 3-Clause "New" or "Revised" License
1.24k stars 359 forks source link

Segmentation Fault when Cellpose is not First Import on M3 Mac [BUG] #946

Open bennm37 opened 1 month ago

bennm37 commented 1 month ago

Importing any package before Cellpose in a python script results in a segfault when the model is instantiated.

import numpy as np # or matplotlib, skimage ...
from cellpose.models import Cellpose

model = Cellpose(gpu=True, model_type='cyto')

However running

from cellpose.models import Cellpose
import numpy as np # or matplotlib, skimage ...

model = Cellpose(gpu=True, model_type='cyto')

works fine.

To Reproduce Running in a cellpose conda environment on 64-bit arm M3 Mac. Installed using https://forum.image.sc/t/cellpose-napari-napari-n2v-installation-and-use/79521/3 but I think same issue with standard installation instructions https://forum.image.sc/t/cellpose-on-macos-m1-pro-apple-silicon-arm64/68018/4 .

Run log

(cellpose) nicholb@CM2WYTVH6V hcr-pypline % python tests/minimal_cellpose_bug.py --verbose
zsh: segmentation fault  python tests/minimal_cellpose_bug.py --verbose
YashM8 commented 4 weeks ago

Even this is giving an error -

from cellpose.models import Cellpose

model = Cellpose(model_type='cyto3')
print("done")

Process finished with exit code 139 (interrupted by signal 11:SIGSEGV)

On a M1 Pro Mac with 16GB of memory.