-3

Today, I noticed that my python code while executing, produces the following upon execution without actually execute the code:

Segmentation fault (core dumped)

After checking out this page (Error: Segmentation fault (core dumped)), I noticed that my python has actually crashed rather than something else.


Here is the error message first I received before my later attempts resulting in the above error message (This is not reproducible and I was lucky to save it somewhere):

Traceback (most recent call last):
  File "my_code.py", line 984, in <module>
    cf = ax12.tricontourf(x, y, z, levels, cmap=cm.get_cmap(cmap, len(levels)-1), norm=norm)
  File "/home/username/anaconda3/lib/python3.6/site-packages/matplotlib/axes/_axes.py", line 8025, in tricontourf
    return mtri.tricontourf(self, *args, **kwargs)
  File "/home/username/anaconda3/lib/python3.6/site-packages/matplotlib/tri/tricontour.py", line 282, in tricontourf
    return TriContourSet(ax, *args, **kwargs)
  File "/home/username/anaconda3/lib/python3.6/site-packages/matplotlib/tri/tricontour.py", line 40, in __init__
    ContourSet.__init__(self, ax, *args, **kwargs)
  File "/home/username/anaconda3/lib/python3.6/site-packages/matplotlib/contour.py", line 846, in __init__
    kwargs = self._process_args(*args, **kwargs)
  File "/home/username/anaconda3/lib/python3.6/site-packages/matplotlib/tri/tricontour.py", line 51, in _process_args
    tri, z = self._contour_args(args, kwargs)
  File "/home/username/anaconda3/lib/python3.6/site-packages/matplotlib/tri/tricontour.py", line 85, in _contour_args
    **kwargs)
  File "/home/username/anaconda3/lib/python3.6/site-packages/matplotlib/tri/triangulation.py", line 164, in get_from_args_and_kwargs
    triangulation = Triangulation(x, y, triangles, mask)
  File "/home/username/anaconda3/lib/python3.6/site-packages/matplotlib/tri/triangulation.py", line 55, in __init__
    self.triangles, self._neighbors = _qhull.delaunay(x, y)
RuntimeError: Error in qhull Delaunay triangulation calculation: precision error (exitcode=3); use python verbose option (-v) to see original qhull error.

By the way, I am using python3 from anaconda on an Ubuntu linux. Is there any way to narrow down the issue by downgrading to some previous versions of python? However, it doesn't seem that python itself has been upgraded recently after checking it through:

conda info python

Thanks,

Rebel
  • 472
  • 8
  • 25
  • We need a *lot* more to go on than that. – user2357112 Aug 09 '18 at 05:01
  • @user2357112, is this welcoming? – Stephen Rauch Aug 09 '18 at 05:02
  • Show a minified version of your code that reproduces this error - read [How to create a Minimal, Complete, and Verifiable example](https://stackoverflow.com/help/mcve) and [how-to-ask](https://stackoverflow.com/help/how-to-ask) as to how to provide us with enough information to enable SO to help you. – Patrick Artner Aug 09 '18 at 05:02
  • Ok ladies and gentlemen, I'm gonna write down the the exact line when the first instance above happened. However, I am not sure if I can minimize my entire code. – Rebel Aug 09 '18 at 05:05
  • 1
    Hi Alalan, according to the new _welcoming tone_ of SO, a downvote and/or close flag für unclear questions is more desirable then commenting maybe hurtful things. The fact that your question already attracted 3 downvotes and a closevote is an indicator of (some of) the SO community, that _something_ is lacking. Try to edit your question so the missing think is added. – Patrick Artner Aug 09 '18 at 05:06
  • And please make sure you don't have an underlying OS problem: check `dmesg`, file systems; reboot... – Klaus D. Aug 09 '18 at 05:08
  • Dear Klaus, I do see some issues in dmesg as error. What should I do? – Rebel Aug 09 '18 at 05:21
  • After rebooting, however, python started working in general but not for the original code that caused the issue in the first place. – Rebel Aug 09 '18 at 05:30
  • Reboot, if the problems persist look for help in one of our sibling sites related to your os. – Klaus D. Aug 09 '18 at 05:30

1 Answers1

1

Are you using virtualenv? You can sometimes get weird errors running Python in virtualenv after updating System Python, usually a segfault or dynamic linking errors. From what I understand this happens because the python executable inside the virtualenv is of different version than the libpython.so that it's trying to load from the system. To work around this issue, you will need to recreate the virtualenv.

Lie Ryan
  • 62,238
  • 13
  • 100
  • 144
  • No, I am using Anaconda. Here is the list of packages that were upgraded just before this error happened but I am not sure if those are related to what you are saying: systemd-sysv, virtualbox-guest-dkms, udev, systemd, libpam-systemd, libsystemd0, libudev1. – Rebel Aug 09 '18 at 06:45
  • I also figured out that in my subplots where I have 8 defined axes, I am not actually using ax8 as I only have 7 panels available. When I try to change the code so I only use a 3*2 panels instead of 4*2, the error disappears. So, I am not sure if this is related to the way I am writing the code or not. – Rebel Aug 09 '18 at 06:48
  • @Allan: Errors in pure python code should never cause a segmentation fault. That kind of error only happens if you either have a broken python installation or in poorly written third party libraries that uses C extensions. – Lie Ryan Aug 09 '18 at 07:03
  • I see. By the way, I forgot to tell you that I actually updated some of Anaconda packages that work with its python. I just don't know how to list those and know which one is causing the issue. – Rebel Aug 09 '18 at 07:33