[Gmsh] Gmsh Pyhon API + matplotlib cause unreadable msh files and Segmentation fault

Baptiste DURAND baptiste.durand at enpc.fr
Fri Oct 25 10:32:27 CEST 2019

Dear all, 

I'm used to using gmsh through the python API, on Ubuntu 18.04. 
With the version 4.4 of gmsh , I am faced with an unwanted behaviour when I try to import both gmsh and matplotlib into the same script. 

Firstly, if matplotlib is imported before gmsh , a Segmentation fault error occurs. 
Steps to reproduce this : 

    * Create a new virtual environment : 
    * Activate this environment : 
    * Install wheels : pip3 install wheels 
    * Install gmsh python API using the gmsh -sdk package on pypi.org : pip3 install gmsh -sdk 
    * Install the matplotlib package : pip3 install matplotlib 
    * Add the line "import matplotlib" before "import gmsh " in the demo script t1.py 
    * Run this demo script in the virtual environment : python3 t1.py 

This results in : Segmentation fault (core dumped) 
If matplotlib is not imported or is imported after gmsh this segmentation fault doesn't occur. 

In addition, if include-system-site-packages is set to true in the configuration file of the virtual environment (pyvenv.cfg) another problem appears. 
I need this setting because I would like to use the FEniCS finite element code and it cannot be installed inside a virtual environment. 
Even if matplotlib is imported after gmsh , the resulting mesh file is unreadable because the decimal separator is a comma. 

Has anyone faced a similar issue ? 

Best regards, 

Baptiste Durand 

Baptiste Durand 
Doctorant – Laboratoire Navier 
baptiste.durand at enpc.fr – 01 64 15 37 21 ( 06 58 88 05 41 ) – linkedin.com/in/baptistedurand 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://onelab.info/pipermail/gmsh/attachments/20191025/2d4e5654/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: t1_with_matplotlib.py
Type: text/x-python
Size: 3631 bytes
Desc: not available
URL: <http://onelab.info/pipermail/gmsh/attachments/20191025/2d4e5654/attachment.py>

More information about the gmsh mailing list