You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Colab inference demo incompatible with current MONAI and NumPy #119
result = cs3d.inference_on_images(
demo_image,
config=inference_config,
)
WARNING:napari_cellseg3d.utils:Caught TypeError: SwinUNETR.__init__() got multiple values for argument 'in_channels'
ERROR:napari_cellseg3d.utils:SwinUNETR.__init__() got multiple values for argument 'in_channels'
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/napari_cellseg3d/code_models/models/model_SwinUNetR.py", line 34, in __init__
super().__init__(
TypeError: SwinUNETR.__init__() got multiple values for argument 'in_channels'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/napari_cellseg3d/code_models/worker_inference.py", line 859, in inference
model = model_class(
^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/napari_cellseg3d/code_models/models/model_SwinUNetR.py", line 47, in __init__
super().__init__(
TypeError: SwinUNETR.__init__() got multiple values for argument 'in_channels'
--------------------
Parameters summary :
Model is : SwinUNetR
Window inference is enabled
Window size is 64
Window overlap is 0.25
Dataset loaded on cuda device
--------------------
MODEL DIMS : [64, 64, 64]
Model name : SwinUNetR
Instantiating model...
Changing numpy and monai versions solved the issue for me:
Thanks a lot for reporting; I’m currently updating the package to run properly on Python 3.12 and to fix several deprecated/old calls, including the newshape issue.
The SwinUNETR.__init__() got multiple values for argument 'in_channels' error looks related to MONAI API/version compatibility, so I’m checking that as part of the update as well. In my limited local testing, the plugin is now running reasonably well with recent napari/MONAI versions, but I remember this being broken by a MONAI update, they might have fixed it in a subsequent release however as I got it to run locally. Will investigate this further.
Version 0.2.4 is now live, which moves the supported Python versions to 3.10-3.12.
This fixes all deprecation errors, and I've confirmed that all models run properly locally.
Please let me know if it still fails on Colab with the latest!
Hi @C-Achard thank you very much for the prompt response! I just tested the notebook and it looks like pyclesperanto is required but now missing:
# @title Load libraries
import napari_cellseg3d
from tifffile import imread
from pathlib import Path
from napari_cellseg3d.dev_scripts import remote_inference as cs3d
from napari_cellseg3d.utils import LOGGER as logger
import logging
logger.setLevel(logging.INFO)
output:
_/usr/local/lib/python3.12/dist-packages/pyclesperanto/__init__.py:29: RuntimeWarning: No pyclesperanto backend installed.
Install one with:
pip install pyclesperanto[opencl] # for OpenCL
pip install pyclesperanto[cuda] # for CUDA
pip install pyclesperanto[metal] # for Metal
pip install pyclesperanto[all] # for both
warnings.warn(_
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
[/tmp/ipykernel_5093/3519197974.py](https://localhost:8080/#) in <cell line: 0>()
4 post_process_config = cs3d.PostProcessConfig()
5 # select cle device for colab
----> 6 import pyclesperanto_prototype as cle
7 cle.select_device("cupy")
ModuleNotFoundError: No module named 'pyclesperanto_prototype'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------
Okay, the issue was a bit sneakier: the Open in Colab URL was pointing to the MMathisLab fork instead of this repo, so it was not showing the latest version.
I will PR a new version with uv, check it works fine, and get back to you!
Activity
C-Achard commentedon May 19, 2026
Hello @msayr,
Thanks a lot for reporting; I’m currently updating the package to run properly on Python 3.12 and to fix several deprecated/old calls, including the
newshapeissue.The
SwinUNETR.__init__() got multiple values for argument 'in_channels'error looks related to MONAI API/version compatibility, so I’m checking that as part of the update as well. In my limited local testing, the plugin is now running reasonably well with recent napari/MONAI versions, but I remember this being broken by a MONAI update, they might have fixed it in a subsequent release however as I got it to run locally. Will investigate this further.Thanks again!
Best,
Cyril
C-Achard commentedon May 19, 2026
Closed automatically by #120, re-opening until released/fix is confirmed
C-Achard commentedon May 21, 2026
Hello @msayr,
Version 0.2.4 is now live, which moves the supported Python versions to 3.10-3.12.
This fixes all deprecation errors, and I've confirmed that all models run properly locally.
Please let me know if it still fails on Colab with the latest!
Thanks again,
Cyril
msayr commentedon May 21, 2026
Hi @C-Achard thank you very much for the prompt response! I just tested the notebook and it looks like pyclesperanto is required but now missing:
output:
###########
output:
C-Achard commentedon May 21, 2026
Hi @msayr,
Yes, apologies, we are no longer using the prototype version, this should work by removing the
_prototypesuffix.There was a small issue with the release that required immediate attention, I will check the Colab notebook more thoroughly soon.
Best,
Cyril
C-Achard commentedon May 21, 2026
Okay, the issue was a bit sneakier: the Open in Colab URL was pointing to the
MMathisLabfork instead of this repo, so it was not showing the latest version.I will PR a new version with uv, check it works fine, and get back to you!
C-Achard commentedon May 22, 2026
@msayr Here is the link to the updated notebook:
https://colab.research.google.com/github/AdaptiveMotorControlLab/CellSeg3D/blob/main/notebooks/Colab_inference_demo.ipynb
Let me know if there are any issues! Thanks again.