Error when opening slicer - many instances trying to run

Hello everyone,

I’m using 4.10.2 version, but in the last 2 days it became unusable: it tries to open, there are many instances appearing to open, but it goes like this for as long as my patience goes. Did you happen to bump into this problem? What else could i do except for installing 4.11?

the error log is here

Many thanks!

This usually happens when you have a batch file that starts Slicer in one of the directories specified in “addititional module paths”. The solution is to remove that file.

The reason is that Slicer interprets all executables (exe, py, bat, sh,… files) in module paths as modules. All module files are executed at Slicer startup as part of the module discovery process. If one of these executables starts Slicer then you get an infinite loop.

If we need to build a new module but this keeps happening, is there a way to fix it without removing that module from the “additional module paths”?

You can keep the module in the path but move non-module executables to a different folder (e.g., into a subfolder). Or, you can even leave your non-module executables there but make sure that if Slicer launches them (you can determine that from the command-line arguments) then you don’t launch another Slicer instance.

I tried moving the non-executables in a subfolder but when I try to run slicer it gives me the error that the module has failed to be instantiated. These are the files in my module-build folder (after removing them from the subfolder) :

The module only appears when I keep all the files together, but many instances are running. I am not sure what to try next. Any other suggestions?

All fixed! I had the wrong path to the “additional modules path”… :woman_facepalming:

1 Like

I’ve faced this problem and figured out that because I used subprocess lib to install python package automatically it seems work on mac but not for window then I just knew slicer lib also has easy way to install package by just import slicer and slicer.util.pip_install()