# Jupyter kernel crashes during MCsquare beamlet calculation on Linux

**URL:** <https://opentps.discourse.group/t/jupyter-kernel-crashes-during-mcsquare-beamlet-calculation-on-linux/131>\
**Category:** General\
**Created:** [August 28, 2026, 2:37pm UTC](https://opentps.discourse.group/t/jupyter-kernel-crashes-during-mcsquare-beamlet-calculation-on-linux/131 "2026-08-28T14:37:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pongphanot](https://avatars.discourse-cdn.com/v4/letter/p/898d66/32.png) [@Pongphanot](https://opentps.discourse.group/u/Pongphanot)\
**Post date:** [August 28, 2026, 2:37pm UTC](https://opentps.discourse.group/t/jupyter-kernel-crashes-during-mcsquare-beamlet-calculation-on-linux/131/1 "2026-08-28T14:37:50Z")

</div>

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:

```auto
dose_calculator.computeBeamlets(...)

```

I added debug messages and narrowed it down to:

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

```

The last output before the Jupyter kernel dies is:

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

```

The native call:

```auto
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?

---

<div class="post-metadata">

**Author:** ![Romain\_Schyns](https://yyz2.discourse-cdn.com/free1/user_avatar/opentps.discourse.group/romain_schyns/32/64_2.png) [@Romain\_Schyns](https://opentps.discourse.group/u/Romain_Schyns)\
**Post date:** [August 31, 2026, 12:53pm UTC](https://opentps.discourse.group/t/jupyter-kernel-crashes-during-mcsquare-beamlet-calculation-on-linux/131/2 "2026-08-31T12:53:55Z")

</div>

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](mailto: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
