title: Jupyter | The kernel appears to have died. It will restart automatically |
body: <p>I have been running a particular python script for some time. All of the script had been running perfectly fine (including in Jupyter) for many months before this. Now, somehow, the jupyter in my system has started showing the following error message at one particular line of the code (the last line of the below mentioned code). All parts of the code run fine, except for the last line of the code (where I call a user defined function to do pair counts). The user defined function (correlation.polepy) can be found from <a href="https://github.com/OMGitsHongyu/N-body-analysis" rel="noreferrer">https://github.com/OMGitsHongyu/N-body-analysis</a></p>
  <p>This is the error message that I am getting:</p>
  <pre><code> Kernel Restarting
   The kernel appears to have died. It will restart automatically.
  </code></pre>
  <p>And, here is the skeleton of my Python Code:</p>
  <pre><code>from __future__ import division
  import numpy as np
  import correlation
  from scipy.spatial import cKDTree
  
  File1 = np.loadtxt('/Users/Sidd/Research/fname1.txt')
  File2 = np.loadtxt('/Users/Sidd/Research/fname2.txt')
  
  masscut = 1.1*np.power(10,13)
  mark1 = (np.where(File1[:,0]&gt;masscut))[0]
  mark2 = (np.where(File2[:,0]&gt;masscut))[0]
  
  Data1 = File1[mark1,1:8]
  Data2 = File2[mark2,1:8]
  
  Xi_masscut = correlation.polepy(p1=Data1, p2=Data2, rlim=150, nbins=150, nhocells=100, blen=1024, dis_f=100)
  </code></pre>
  <p>Similar problem happens (last line of the code) when I try to use IPython. When I try to use Python (implement in terminal), I get an error message (at the last line) which says &quot;<strong>Segmentation fault: 11</strong>&quot;. I am using <strong>Python 2.7.13 :: Anaconda 2.5.0 (x86_64)</strong>.</p>
  <p>I have tried the following methods already in search for a solution:</p>
  <p><strong>1.&gt;</strong> I checked some of the previous links on stackoverflow where this problem has been asked: <a href="https://stackoverflow.com/questions/42912076/the-kernel-appears-to-have-died-it-will-restart-automatically">The kernel appears to have died. It will restart automatically</a></p>
  <p>I tried the solution given in the link above; sadly it doesn't seem to work for my case. This is the solution that was mention in the link given above:</p>
  <pre><code>conda update mkl
  </code></pre>
  <p><strong>2.&gt;</strong> Just to check if the system is running out of memory, I closed all applications which are heavy on memory. My system has 16 GB physical memory and even when there is over 9 GB of free memory, this problem happens (again, this problem had not been happening before, even when I had been using 14 GB in other tasks and had less than 2 GB of memory. It's very surprising that I could run task with given inputs before and I am not able to replicate calculation with the same exact inputs now.)</p>
  <p><strong>3.&gt;</strong> I saw another link:
  <a href="https://alpine.atlassian.net/wiki/plugins/servlet/mobile?contentId=134545485#content/view/134545485" rel="noreferrer">https://alpine.atlassian.net/wiki/plugins/servlet/mobile?contentId=134545485#content/view/134545485</a></p>
  <p>This one appears to tackle similar problems and it speaks about there not being <strong>enough memory for the docker container</strong>. I had doubts about how to implement the suggestions mentioned in there.</p>
  <p>How do I solve this problem?</p>