Python code exit abnormally. custom plugin development

Hello I am developing a plugin for my research and encountering with a problem when I am running certain code. However error is not reproducible when I am running same code on PythonSlicer (built in in slicer). Here I attach code and logs from correct run in slicerpython and slicer error failed
slicerpython log:

    *:~$ /home/user/slic_build/python-install/bin/PythonSlicer*
    Python 3.9.10 (main, Dec 12 2023, 14:56:38)
    [GCC 11.4.0] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> from brainextractor import BrainExtractor
    >>> import nibabel as nib
    >>> image = nib.load("/tmp/tmp14016ra4/t1.nii.gz")
    >>> vet = BrainExtractor(image)
    >>> vet.run()
     vet.run()
    Running surface deformation...
    Iteration: 999
    Complete.

SLICER RUN:

Running surface deformation…
error: [/home/user/slic_build/Slicer-build/bin/./SlicerApp-real] exit abnormally - Report the problem.

@IVarha, did you installed any python packages within the 3D Slicer environment with pip (i.e., brainextractor)? Installing certain packages with pip may override the version of those packages provided by Slicer, sometimes producing crashes. If you have built your own Slicer, you could try to provide more information using a debugger:

C++ debugging on GNU/Linux systems — 3D Slicer documentation

You are right I installed some other packages through pip. However as I mentioned when I use python which is used in slicer it works. Is C++ debugging my only option?(I use Wsl, therefore not sure it would be easy to install)

@IVarha, package collision is one hypothesis, to get a better picture of the error debugging is the way. I’ve never used WSL, but it seems it is possible:

1 Like

You can use the HDBrainExtraction extension in Slicer.