# Kernel Crashes in Jupyter Notebook when fitting a histogram in pyRoot

**URL:** <https://root-forum.cern.ch/t/kernel-crashes-in-jupyter-notebook-when-fitting-a-histogram-in-pyroot/62737>\
**Category:** Newbie\
**Tags:** python, hist\
**Created:** [January 23, 2025, 12:19pm UTC](https://root-forum.cern.ch/t/kernel-crashes-in-jupyter-notebook-when-fitting-a-histogram-in-pyroot/62737 "2025-01-23T12:19:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![yann](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/bc79bd/32.png) [@yann](https://root-forum.cern.ch/u/yann)\
**Post date:** [January 23, 2025, 12:19pm UTC](https://root-forum.cern.ch/t/kernel-crashes-in-jupyter-notebook-when-fitting-a-histogram-in-pyroot/62737/1 "2025-01-23T12:19:21Z")

</div>

When fitting a TF1 function to a TH1F histogram within a cell in a jupyter notebook  
the kernel crashes, if there is no code below the fit command.  
Why does this happen?

Minimal example:

```auto
# Cell 1
from ROOT import TH1F, TF1, TRandom3
RNG = TRandom3(42)
hist1 = TH1F("hist1", "Exp;t;N", 10, 0., 10.)
for entry in range(100):
        num = RNG.Exp(2.0)
        hist1.Fill(num)

expFunk1 = TF1("expFunk1", "([1]/[0])*TMath::Exp(-x/[0])", 0.0, 100.0)
expFunk1.SetParameter(0, 2.0)
expFunk1.SetParameter(1, 100)

```

```auto
# Cell 2
hist1.Fit("expFunk1", "LI")

```

Note: If you include any command below the fit in Cell 2 the kernel will not crash  
and the fit works.

_ROOT Version:_ JupyROOT 6.28/02  
_Compiler:_ Python 3 (ipykernel)

* * *

---

<div class="post-metadata">

**Author:** ![devajith](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/devajith/32/37165_2.png) [@devajith](https://root-forum.cern.ch/u/devajith)\
**Post date:** [January 23, 2025, 12:54pm UTC](https://root-forum.cern.ch/t/kernel-crashes-in-jupyter-notebook-when-fitting-a-histogram-in-pyroot/62737/2 "2025-01-23T12:54:58Z")

</div>

Hi @yann,

Welcome to the ROOT forum.

Can you provide a crash log so that it is easier for us to look into the issue?

Cheers,  
Dev

---

<div class="post-metadata">

**Author:** ![yann](https://root-forum.cern.ch/letter_avatar_proxy/v4/letter/y/bc79bd/32.png) [@yann](https://root-forum.cern.ch/u/yann)\
**Post date:** [January 23, 2025, 1:13pm UTC](https://root-forum.cern.ch/t/kernel-crashes-in-jupyter-notebook-when-fitting-a-histogram-in-pyroot/62737/3 "2025-01-23T13:13:12Z")

</div>

Hi Dev! I got to admit I am not quite sure where to search for a proper log file. I am using a Docker Image that was set up for teaching purposes. All I get in the docker-interface log is: “WARNING:root:kernel 825481f0-5c19-4bae-a1c5-df5288c54c3d restarted”.

---

<div class="post-metadata">

**Author:** ![devajith](https://root-forum.cern.ch/user_avatar/root-forum.cern.ch/devajith/32/37165_2.png) [@devajith](https://root-forum.cern.ch/u/devajith)\
**Post date:** [January 23, 2025, 1:40pm UTC](https://root-forum.cern.ch/t/kernel-crashes-in-jupyter-notebook-when-fitting-a-histogram-in-pyroot/62737/4 "2025-01-23T13:40:31Z")

</div>

I am unable to reproduce this issue locally. Maybe @jonas can give you some pointers.
