Repository navigation
Labels
Description
Hi there,
I was trying out the Colab inference notebook ([here])(https://colab.research.google.com/github/MMathisLab/CellSeg3d/blob/main/Notebooks/Colab_inference_demo.ipynb#scrollTo=IFbmZ3_zAm-1) and I've gotten the following error. All original code above this line ran without error:
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:
!pip install -U "numpy>=2.1,<2.6" "monai==1.3.2"
import numpy, monai
print("NumPy:", numpy.__version__)
print("MONAI:", monai.__version__)
NumPy: 2.4.6
MONAI: 1.3.2
Then updating reshape to shape to match different numpy version:
from pathlib import Path
p = Path("/usr/local/lib/python3.12/dist-packages/napari_cellseg3d/code_models/worker_inference.py")
s = p.read_text()
s = s.replace("np.reshape(volume, newshape=(1, *volume.shape))",
"np.reshape(volume, (1, *volume.shape))")
p.write_text(s)
print("Patched:", p)
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.