Repository navigation
RunCellpose crashes when using Podman with GPU in Mac #293
Copy link
Copy link
Open
Description
I'm trying to run Runcellpose on the images from the sample Cellprofiler pipeline using Podman on a M2 Mac, but it crashes when I want to use the GPU.
Running any version of Cellpose with or without GPU works fine when running from Python. I also have allocated as much memory as possible to Podman (~16GB).
V4 with GPU
Module crashes with the following error:
['/opt/podman/bin/podman', 'run', '--rm', '-v', '/Users/emigliet/Desktop/.cellprofiler_temp/feb751a2-1c11-4a5c-8163-82dd6c644b5c:/data', 'cellprofiler/runcellpose_with_pretrained:4.0.6', '--gpus', 'all', 'cellpose', '--verbose', '--dir', '/data/img', '--pretrained_model', 'cpsam', '--cellprob_threshold', '0.0', '--min_size', '15', '--anisotropy', '0.0', '--flow_threshold', '0.4', '--stitch_threshold', '0.0', '--exclude_on_edges']
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
==========
== CUDA ==
==========
CUDA Version 11.8.0
Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available.
Use the NVIDIA Container Toolkit to start this container with GPU support; see
https://docs.nvidia.com/datacenter/cloud-native/ .
/opt/nvidia/nvidia_entrypoint.sh: line 67: exec: --: invalid option
exec: usage: exec [-cl] [-a name] [command [argument ...]] [redirection ...]
Failed to run module RunCellpose
Traceback (most recent call last):
File "/Users/emigliet/Documents/GitHub/CP_DEV/CellProfiler-plugins/active_plugins/runcellpose.py", line 1011, in run
cellpose_output = numpy.load(os.path.join(temp_img_dir, unique_name + "_seg.npy"), allow_pickle=True).item()
File "/Users/emigliet/anaconda3/envs/cellposeSAM_cellprofiler/lib/python3.9/site-packages/numpy/lib/npyio.py", line 405, in load
fid = stack.enter_context(open(os_fspath(file), "rb"))
FileNotFoundError: [Errno 2] No such file or directory: '/Users/emigliet/Desktop/.cellprofiler_temp/feb751a2-1c11-4a5c-8163-82dd6c644b5c/img/feb751a2-1c11-4a5c-8163-82dd6c644b5c_seg.npy'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Users/emigliet/anaconda3/envs/cellposeSAM_cellprofiler/lib/python3.9/site-packages/cellprofiler/gui/pipelinecontroller.py", line 3390, in do_step
self.__pipeline.run_module(module, workspace_model)
File "/Users/emigliet/anaconda3/envs/cellposeSAM_cellprofiler/lib/python3.9/site-packages/cellprofiler_core/pipeline/_pipeline.py", line 1349, in run_module
module.run(workspace)
File "/Users/emigliet/Documents/GitHub/CP_DEV/CellProfiler-plugins/active_plugins/runcellpose.py", line 1015, in run
raise(FileNotFoundError("I'm sorry, Cellpose seems to have crashed and I'm not sure why, since it's in its own container."))
FileNotFoundError: I'm sorry, Cellpose seems to have crashed and I'm not sure why, since it's in its own container.
Using cp4 from python in the same environment works just fine using GPU :
Loading new model: cpsam
** TORCH MPS version installed and working. **
>>>> using GPU (MPS)
>>>> loading model /Users/emigliet/.cellpose/models/cpsam
Failed to set GPU memory share. Please check your PyTorch installation. Not setting per-process memory share.
V4 wit CPU
Run seems to freeze but just takes forever (with a very small 2D image), but eventually works:
['/opt/podman/bin/podman', 'run', '--rm', '-v', '/Users/emigliet/Documents/Proyectos FIL/Isa106/PICTO fotos para Esteban/MHCII-IBA1 9abril24.mdb/CP_output/.cellprofiler_temp/74ffc9db-c9b6-485c-95c5-68496d222a7e:/data', 'cellprofiler/runcellpose_with_pretrained:4.0.6', 'cellpose', '--verbose', '--dir', '/data/img', '--pretrained_model', 'cpsam', '--cellprob_threshold', '0.0', '--min_size', '15', '--anisotropy', '0.0', '--flow_threshold', '0.4', '--stitch_threshold', '0.0', '--exclude_on_edges']
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
==========
== CUDA ==
==========
CUDA Version 11.8.0
Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available.
Use the NVIDIA Container Toolkit to start this container with GPU support; see
https://docs.nvidia.com/datacenter/cloud-native/ .
Welcome to CellposeSAM, cellpose v
cellpose version: 4.0.6
platform: linux
python version: 3.11.13
torch version: 2.7.1+cu118! The neural network component of
CPSAM is much larger than in previous versions and CPU excution is slow.
We encourage users to use GPU/MPS if available.
creating new log file
2025-09-24 21:25:41,008 [INFO] WRITING LOG OUTPUT TO /root/.cellpose/run.log
2025-09-24 21:25:41,010 [INFO]
cellpose version: 4.0.6
platform: linux
python version: 3.11.13
torch version: 2.7.1+cu118
2025-09-24 21:25:41,011 [INFO] >>>> using CPU
2025-09-24 21:25:41,011 [INFO] >>>> using CPU
2025-09-24 21:25:41,011 [WARNING] the '--diam_mean' flag is deprecated in v4.0.1+ and no longer used
2025-09-24 21:25:41,026 [INFO] >>>> running cellpose on 1 images using all channels
2025-09-24 21:25:53,613 [INFO] >>>> loading model /root/.cellpose/models/cpsam
2025-09-24 21:25:57,953 [INFO] 0%| | 0/1 [00:00<?, ?it/s]
[W924 21:25:58.430460378 NNPACK.cpp:57] Could not initialize NNPACK! Reason: Unsupported hardware.
[W924 22:02:25.092945292 NNPACK.cpp:57] Could not initialize NNPACK! Reason: Unsupported hardware.
[W924 22:02:27.676032493 NNPACK.cpp:57] Could not initialize NNPACK! Reason: Unsupported hardware.
[W924 22:02:30.128416575 NNPACK.cpp:57] Could not initialize NNPACK! Reason: Unsupported hardware.
2025-09-24 22:02:32,760 [INFO] 100%|##########| 1/1 [36:34<00:00, 2194.80s/it]
2025-09-24 22:02:32,763 [INFO] 100%|##########| 1/1 [36:34<00:00, 2194.81s/it]
2025-09-24 22:02:32,764 [INFO] >>>> completed in 2211.752 sec
V3 wit GPU
Produces the same error as V4
V3 with CPU
Runs fine
['/opt/podman/bin/podman', 'run', '--rm', '-v', '/Users/emigliet/Documents/Proyectos FIL/Isa106/PICTO fotos para Esteban/MHCII-IBA1 9abril24.mdb/CP_output/.cellprofiler_temp/40b2665a-c727-45fa-8b54-dc8b00b1d3e0:/data', 'cellprofiler/runcellpose_with_pretrained:3.1.1.2', 'cellpose', '--verbose', '--dir', '/data/img', '--pretrained_model', 'cyto3', '--chan', '0', '--chan2', '0', '--diameter', '30', '--cellprob_threshold', '0.0', '--min_size', '15', '--anisotropy', '0.0', '--flow_threshold', '0.4', '--stitch_threshold', '0.0']
WARNING: image platform (linux/amd64) does not match the expected platform (linux/arm64)
==========
== CUDA ==
==========
CUDA Version 11.8.0
Container image Copyright (c) 2016-2023, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
This container image and its contents are governed by the NVIDIA Deep Learning Container License.
By pulling and using the container, you accept the terms and conditions of this license:
https://developer.nvidia.com/ngc/nvidia-deep-learning-container-license
A copy of this license is made available in this container at /NGC-DL-CONTAINER-LICENSE for your convenience.
WARNING: The NVIDIA Driver was not detected. GPU functionality will not be available.
Use the NVIDIA Container Toolkit to start this container with GPU support; see
https://docs.nvidia.com/datacenter/cloud-native/ .
creating new log file
2025-09-24 22:07:08,464 [INFO] WRITING LOG OUTPUT TO /root/.cellpose/run.log
2025-09-24 22:07:08,467 [INFO]
cellpose version: 3.1.1.2
platform: linux
python version: 3.11.13
torch version: 2.7.1+cu118
2025-09-24 22:07:08,467 [INFO] >>>> using CPU
2025-09-24 22:07:08,467 [INFO] >>>> using CPU
2025-09-24 22:07:08,490 [INFO] >>>> running cellpose on 1 images using chan_to_seg GRAY and chan (opt) NONE
2025-09-24 22:07:08,490 [INFO] >>>> using CPU
2025-09-24 22:07:08,490 [INFO] >>>> using CPU
2025-09-24 22:07:08,491 [INFO] >> cyto3 << model set to be used
2025-09-24 22:07:08,891 [INFO] >>>> loading model /root/.cellpose/models/cyto3
2025-09-24 22:07:09,606 [INFO] >>>> model diam_mean = 30.000 (ROIs rescaled to this size during training)
2025-09-24 22:07:09,607 [INFO] Downloading: "https://www.cellpose.org/models/size_cyto3.npy" to /root/.cellpose/models/size_cyto3.npy
100%|██████████| 3.54k/3.54k [00:00<00:00, 924kB/s]
2025-09-24 22:07:10,525 [INFO] >>>> using diameter 30.000 for all images
2025-09-24 22:07:10,527 [INFO] 0%| | 0/1 [00:00<?, ?it/s]
2025-09-24 22:07:10,536 [INFO] channels set to [0, 0]
2025-09-24 22:07:10,536 [INFO] ~~~ FINDING MASKS ~~~
2025-09-24 22:08:07,691 [INFO] >>>> TOTAL TIME 57.15 sec
2025-09-24 22:08:07,738 [INFO] 100%|##########| 1/1 [00:57<00:00, 57.21s/it]
2025-09-24 22:08:07,739 [INFO] 100%|##########| 1/1 [00:57<00:00, 57.21s/it]
2025-09-24 22:08:07,739 [INFO] >>>> completed in 59.271 sec
Metadata
Metadata
Assignees
Labels
No labels
Activity
emiglietta commentedon Sep 25, 2025
UPDATE: I checked my Podman Desktop configuration and Rosetta is enabled
bethac07 commentedon Sep 25, 2025
Do you have Docker Desktop and can check to see if the behavior is the same between each? Fine if no just checking.
Seems like for Podman, we might need to think about making arm and non arm versions, but I suspect fewer people will be using Podman so that might affect the priority of doing that.
emiglietta commentedon Sep 25, 2025
I don't have Docker Desktop on my machine (since I don't routinely use it, it made no sense to pay for the license), that's why I wanted to try Podman, in case I need to try something on a container for a collaborator :)
ShataDg commentedon Oct 14, 2025
I was running

CellProfiler 4.2.8withCellpose 4with theDockeroption and withuse GPUset to yes, and I received the same error.RunCellposedoes work withuse GPUset to no, but it takes quite a while. I have tried using the default values as well as increasing the values forGPU_memory_share, but it gives the same error.The following trace is
CellProfiler 4.2.6withCellpose 4(because I do not haveCellProfiler 4.2.8built from source)braymp commentedon Jan 15, 2026
@ShataDg : I receive the same error on Windows/CP 4.2.8. According to this post, #276 (comment) it may not be possible to get Docker+GPU working (which makes me sad) but perhaps @ErinWeisbart has updates?