Hi Francis, There appears to be something called vext.vtk which claims to make system vtk accessible from inside a virtualenv. There is also this email: http://vtk.1045678.n5.nabble.com/Re-VTK-in-virtualenv-td5716725.html I have to confess that I have not really tried either. Regards, David On Mon, 20 Mar 2017 at 01:40 Francis Poulin <fpoulin@uwaterloo.ca> wrote:
Thanks for suggesting PyGmsh! I bumped into it a while ago but never really figured it out. Now I'm keen since it should help building and modifying meshes more easily.
I installed pygmsh easily using the instructions on the website. It imports correctly. There is even an example that builds a circle, I think.
When I try running this, as well as other examples, I get an error because no module named vtk is found. See below. I get this comes from meshio?
Traceback (most recent call last):
File "circle.py", line 24, in <module> meshio.write('circle.vtu', *out) File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/meshio/__init__.py", line 187, in write field_data=field_data File "/home/fpoulin/software/firedrake/local/lib/python2.7/site-packages/meshio/vtk_io.py", line 204, in write import vtk ImportError: No module named vtk
When I do a pip install it tells me that it is already installed and up to date.
(firedrake) fpoulin@fpoulin-Gazelle:~/software/pygmsh/test/examples$ pip install -U meshio Requirement already up-to-date: meshio in /home/fpoulin/software/firedrake/lib/python2.7/site-packages Requirement already up-to-date: pipdated in /home/fpoulin/software/firedrake/lib/python2.7/site-packages (from meshio) Requirement already up-to-date: numpy in /home/fpoulin/software/firedrake/lib/python2.7/site-packages (from meshio) Requirement already up-to-date: requests in /home/fpoulin/software/firedrake/lib/python2.7/site-packages (from pipdated->meshio) Requirement already up-to-date: appdirs in /home/fpoulin/software/firedrake/lib/python2.7/site-packages (from pipdated->meshio)
I realize this isn't necessarily a firedrake question but if anyone had an idea on how to get this working I would be keen to try it.
Cheers, Francis ------------------ Francis Poulin Associate Professor Department of Applied Mathematics University of Waterloo
email: fpoulin@uwaterloo.ca Web: https://uwaterloo.ca/poulin-research-group/ Telephone: +1 519 888 4567 x32637 <(519)%20888-4567>
------------------------------ *From:* firedrake-bounces@imperial.ac.uk [firedrake-bounces@imperial.ac.uk] on behalf of G. D. McBain [gdmcbain@protonmail.com] *Sent:* Sunday, March 19, 2017 6:16 PM
*To:* firedrake@imperial.ac.uk *Subject:* Re: [firedrake] circles in firedrake?
I would expect a user to run gmsh separately (at the command line or through the GUI), rather than from within the Python script. I don't think it's possible to interact with gmsh from Python nowadays without jumping through considerable hoops.
Have you tried the (free third-party) PyGmsh? It generates .geo code from Python. From there one calls Gmsh using Python subprocess and reads in the resulting .msh. I've found it handy.
https://github.com/nschloe/pygmsh
--
Dr David Ham Department of Mathematics Imperial College London