Bug report #20387

The call to matplotlib tricontour causes QGIS to crash

Added by Ondrej Lexa about 1 year ago. Updated about 1 year ago.

Status:Open
Priority:High
Assignee:-
Category:Python bindings / sipify
Affected QGIS version:3.4.1 Regression?:No
Operating System:Ubuntu 18.04 Easy fix?:No
Pull Request or Patch supplied:No Resolution:
Crashes QGIS or corrupts data:Yes Copied to github as #:28207

Description

Developing plugin, I found that QGIS 3.4 crashes during calculation of matplotlib.tri.Triangulation. The problem appears only running matplotlib.tri.Triangulation within the QGIS3 python environment. The problem has been reported already in QGIS 3.1 (https://github.com/ccrook/QGIS-Contour-Plugin/issues/23) and the workaround is to calculate Triangulation in shell script, save the result to file and import back to QGIS python session. I'm using QGIS version 3.4.1-Madeira QGIS code revision 383851c, Python 3.6.6, matplotlib 2.1.1 on Ubuntu 18.04.

Example python code to crash QGIS

import matplotlib.pyplot as plt
import matplotlib.tri as tri
import numpy as np

radii = np.linspace(0.25, 0.95, 8)
angles = np.linspace(0, 2*np.pi, 36, endpoint=False)
angles = np.repeat(angles[..., np.newaxis], 8, axis=1)
angles[:, 1::2] += pi/n_angles

x = (radii*np.cos(angles)).flatten()
y = (radii*np.sin(angles)).flatten()

# This call crahes QGIS
triang = tri.Triangulation(x, y)

History

#1 Updated by Giovanni Manghi about 1 year ago

  • Priority changed from Normal to High
  • Category changed from Python plugins to Python bindings / sipify

Also available in: Atom PDF