Jupyter kernel crashes during MCsquare beamlet calculation on Linux

Hi everyone, I am having an issue running OpenTPS proton plan optimization from a Python/Jupyter workflow on Linux.

Setup:

  • Linux workstation

  • Python 3.12

  • OpenTPS 3.0.1

  • VS Code + Jupyter

The crash occurs when calling:

dose_calculator.computeBeamlets(...)

I added debug messages and narrowed it down to:

MCsquareDoseCalculator.computeBeamlets()
→ _computeBeamletsLinux()
→ MCsquareSharedLib.computeBeamletsSharedLib()
→ computeBeamletsSparseMat()

The last output before the Jupyter kernel dies is:

You are running MCsquare from shared library
Warning: Unknown tag "Optimization_Mode" in config.txt

The native call:

self._libsparseMat.computeBeamletsSparseMat(...)

never returns to Python, so the crash seems to happen inside libMCsquare.so.

Interestingly, beamlet calculation through the OpenTPS GUI on the same Linux system can proceed further, while the Jupyter kernel crashes at this native call.

Has anyone encountered this issue when using computeBeamlets() from Jupyter/Python on Linux? Is there any known difference between how the GUI and a standalone Python workflow initialize or call the MCsquare shared library?

Hello Pongphanot,

I could not reproduce the issue on my side with the same OpenTPS version.

As a first step, could you try running the same workflow outside of the Jupyter kernel, directly from a Python script? This would help us determine whether the issue is specific to the Jupyter environment.

In any case, could you also share the Jupyter code you are using by email (info.opentps@gmail.com) ? This would allow us to try to reproduce the issue and investigate what might be different in your workflow or if the error comes from Jupyter kernels.

Best regards,

Romain Schyns