VS Code launches two Slicers on selecting workspace

Hi all,

I’ve used VS Code with Slicer without problems in the past. However, for about a week, something strange and annoying happens when I start VS Code or when I switch workspaces:
two Slicer instances are launched, opening their whole UI, starting with this message
image

The strange thing is that these Slicers are not the ones I specified as the interpreter, which is "python.defaultInterpreterPath": c:\\d\\S5R\\python-install\\bin\\PythonSlicer.exe, but installed 5.0.2’s which I don’t know where VS Code knows about.

>>> slicer.app.slicerHome
'C:/Users/pinte/AppData/Local/NA-MIC/Slicer 5.0.2/bin/..'

The splash screen popped up before as well on startup or workspace switch, but this is new and I have no idea how to get rid of these 5.0.2 startups. Thanks for any help!

1 Like

The splash screen popped up before as well on startup or workspace switch, but this is new and I have no idea how to get rid of these 5.0.2 startups.

I’ve also been getting a Slicer splash screen on VS Code launch.
I’m on Ubuntu 20.04.

The splash screen is OK, my problem is different, and it is a blocking issue for me. Please focus on that if you have any insight.

1 Like

VS Code (and its Python and Jupyter extensions) is very opinionated. It makes lots of assumptions about your Python environment and uses low-level hacks that only work well if all those assumptions are correct (e.g., if you use a standard Python environment).

It seems that the VS Code Python plugin queries interpreter parameters at startup via an output capture wrapper script for all interpreters it knows about.

VS Code assumes that launching a Python interpreter is an invisible, very lightweight operation. It is true for many cases, it would be no problem for PythonSlicer.exe interpreter, etc. but the assumption is not true for Slicer.exe, which is not a lightweight process.

The solution is probably to remove Slicer.exe from the list of interpreters that VS Code knows about. One possible solution (from here) is to temporarily remove Slicer.exe, start VS Code, and select the no-longer-existing Slicer.exe Python interpreter. But maybe you can find the list of interpreters somewhere else and remove Slicer.exe from that list.

2 Likes

Thank you very much, looking into it!

Hello, I am having the same problem.
Any solution to solve this problem?

Yes. You need to remove Slicer.exe from the list of Python interpreters in Visual Studio Code as described above (or just tolerate this annoyance - it has no side effects, other than you need to close these Slicer instances that VS Code decided to launch).

But I can’t find any interpreters about slicer.


When I launch vscode, it will start searching slicer kernel.json file.
No error is returned if I set permission for not allowing any program to access.

1 Like