Slicer Crashing on importing antspynet (macOS M3)

Hello I am creating a slicer extension and using antspynet in my development. Previously I used it on windows and it was working fine. I tried to install it in windows environment and it worked well.
I tested imports on my python 3.9 local instance. It works for it.

I tested it with python provided by slicer as well but not get any meaningful logs:

PyDev console: starting.
Python 3.9.10 (main, Apr 5 2024, 00:33:09)
[Clang 14.0.6 (https://github.com/tru/llvm-release-build 686807a176470032c208f2 on darwin
import antspynet
error: [/Applications/Slicer.app/Contents/bin/./python-real] exit abnormally - Report the problem.
Process finished with exit code 1

It seems that antspynet uses tensorflow. Since the medical image computing community largely switched to pytorch, Slicer core developers no longer invest time into tensorflow support. If you need to use tensorflow then you need to investigate this issue yourself (if you have any specific questions then feel free to ask here), or you can install a Python environment where tensorflow works and call that from Slicer.

That is exactly what I used in the end.

Is there any reason why it fails in Slicer but works on general python environment? I have some problems with debugging it as I even don’t see any reasonable failing logs. Maybe it is possible to allow user use their installed python instance instead of PythonSlicer?

Most likely library and build chain clashes…

1 Like