问题描述
我一直在运行特定的python脚本。在此之前的几个月里,所有剧本都运行得非常好(包括在Jupyter中)。现在,不知何故,我的系统中的jupyter已经开始在代码的一个特定行显示以下错误消息(下面提到的代码的最后一行)。代码的所有部分都运行正常,除了代码的最后一行(我称之为用户定义的函数来进行对计数)。用户定义的函数(correlation.polepy)可以从
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 https://github.com/OMGitsHongyu/N-body-analysis
这是我收到的错误消息:
This is the error message that I am getting:
Kernel Restarting
The kernel appears to have died. It will restart automatically.
而且,这是我的Python代码的骨架:
And, here is the skeleton of my Python 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]>masscut))[0]
mark2 = (np.where(File2[:,0]>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)
当我尝试使用IPython时,会发生类似的问题(代码的最后一行)。当我尝试使用Python(在终端中实现)时,我收到一条错误消息(在最后一行),上面写着 Segmentation fault:11 。我正在使用 Python 2.7.13 :: Anaconda 2.5.0(x86_64)。
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 "Segmentation fault: 11". I am using Python 2.7.13 :: Anaconda 2.5.0 (x86_64).
我已经尝试了以下方法来搜索解决方案:
I have tried the following methods already in search for a solution:
1。> 我检查了stackoverflow上的一些先前链接,其中询问了此问题:
1.> I checked some of the previous links on stackoverflow where this problem has been asked: The kernel appears to have died. It will restart automatically
我尝试了上面链接中给出的解决方案;可悲的是,它似乎对我的情况不起作用。这是上面给出的链接中提到的解决方案:
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:
conda update mkl
2。> 为了检查系统是否内存不足,我关闭了所有内存都很大的应用程序。我的系统有16 GB的物理内存,即使有超过9 GB的可用内存,也会出现这个问题(同样,这个问题以前没有发生过,即使我在其他任务中使用14 GB并且少于2 GB非常令人惊讶的是,我之前可以使用给定的输入运行任务,而且我现在无法使用相同的确切输入复制计算。)
2.> 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.)
3 。> 我看到另一个链接:
3.> I saw another link:https://alpine.atlassian.net/wiki/plugins/servlet/mobile?contentId=134545485#content/view/134545485
这个似乎解决了类似的问题,它说的是没有足够的Docker容器内存。我对如何实施那里提到的建议表示怀疑。
This one appears to tackle similar problems and it speaks about there not being enough memory for the docker container. I had doubts about how to implement the suggestions mentioned in there.
总而言之,我不确定这个问题是如何产生的。我该如何解决这个问题?任何帮助将不胜感激。
All in all, I am not sure how this problem arose in the first place. How do I solve this problem? Any help will be much appreciated.
推荐答案
当我在numpy之前导入sklearn PCA时会发生此问题(不确定反向序列将解决问题)
This issue happens when I import sklearn PCA before numpy (not sure reverse the sequence will solve the problem)
但后来我通过重新安装numpy和mkl解决了这个问题:
conda install numpy
和
conda install -c intel mkl
But later I solved the issue by reinstalling numpy and mkl:conda install numpy
andconda install -c intel mkl
这篇关于Jupyter |内核似乎已经死了。它会自动重启|的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!