You are here: Home / Groups / Short-Term Crustal Dynamics / Wiki / PyLith / Installation
  • Discoverability Visible
  • Join Policy Invite Only
  • Created 05 Jan 2021

PyLith /


Issues related to installing PyLith.

OS X binary

Errors on starting PyLith

  • Error:
  'import site' failed; use -v for traceback
  TypeError: stat() argument 1 must be encoded string without NULL bytes, not str

We have seen this error on Darwin system running OS X 10.5 and later. Files downloaded from the web are marked with an extra attribute that can prevent python from starting up properly. The best solution in these cases is to download !PyLith using command line tools:

  mkdir pylith
  cd pylith
  curl -O
  tar -zxf pylith-1.6.2-darwin-10.6.8.tgz

Windows binary

Error on starting PyLith

  • Error:
  ImportError: numpy.core.multiarray failed to import
  Traceback (most recent call last):
    File "/usr/bin/pylith", line 37, in <module>
      from pylith.apps.PyLithApp import PyLithApp
   File "/usr/lib/python2.6/site-packages/pylith/apps/", line 26, in <module>
      class PyLithApp(PetscApplication):
    File "/usr/lib/python2.6/site-packages/pylith/apps/", line 33, in PyLithApp
      class Inventory(PetscApplication.Inventory):
    File "/usr/lib/python2.6/site-packages/pylith/apps/", line 51, in Inventory
      from pylith.topology.MeshImporter import MeshImporter
    File "/usr/lib/python2.6/site-packages/pylith/topology/", line 28, in <module>
      class MeshImporter(MeshGenerator):
    File "/usr/lib/python2.6/site-packages/pylith/topology/", line 37, in MeshImporter
      class Inventory(MeshGenerator.Inventory):
    File "/usr/lib/python2.6/site-packages/pylith/topology/", line 58, in Inventory
      from pylith.meshio.MeshIOAscii import MeshIOAscii
    File "/usr/lib/python2.6/site-packages/pylith/meshio/", line 26, in <module>
      from MeshIOObj import MeshIOObj
    File "/usr/lib/python2.6/site-packages/pylith/meshio/", line 26, in <module>
      from meshio import MeshIO as ModuleMeshIO
    File "/usr/lib/python2.6/site-packages/pylith/meshio/", line 25, in <module>
      _meshio = swig_import_helper()
    File "/usr/lib/python2.6/site-packages/pylith/meshio/", line 21, in swig_import_helper
      _mod = imp.load_module('_meshio', fp, pathname, description)
  ImportError: numpy.core.multiarray failed to import

This error arises from having another version of Python installed that interferes with the Python included with PyLith. The solution is to set your environment variables so that the shell doesn’t see the existing Python when you run PyLith.

  • Double click on the PyLith icon to get the cygwin terminal window for !Pylith.
  • Run “env >& env.log” and examine the env.log file for environment variables related to Python.
  • Remove all environment variables related to Python and set the PATH variable to the absolute minimum. For example:
  unset PYTHON
  unset PYTHON26
  unset PYTHON27
  • You should now be able to use PyLith.

In general, you will need to perform steps 1 and 3 (but not 2) every time you run PyLith. To add these commands to the PyLith startup script, add the commands to the bottom of the pylithrc file included in the PyLith distribution. Usually this file is in Program Files (x86)/PyLith. This shell script is run every time PyLith starts up.

PyLith installer utility

See the INSTALL file included with the PyLith installer utility for directions and example configuration parameters. Troubleshooting tips are also included at the end of the INSTALL file.

  • gcc 4.7
    • We have encountered segmentation faults building netcdf with gcc 4.7 on OS X 10.8 (Mountain Lion). Running “make check” in nctest generates a segmentation fault.
  • clang
    • We have encountered problems building PETSc w/Sieve support using clang due to C/C++ issues.
  • Created on , Last modified on