Pylith Installation of Binary Executable issue

I’m trying to install Pylith on MacOS Catalina, but it doesn’t work.

Traceback (most recent call last):
File “/Users/Man/Pylith/pylith-2.2.2-darwin-10.13.6/bin/pylith”, line 25, in
from pylith.apps.PyLithApp import PyLithApp
ImportError: No module named pylith.apps.PyLithApp

Thanks a lot advance!

Did you do “source setup.sh” in the top-level PyLith directory before trying to run PyLith?

Yes, but not sure if I should change the PATH. Both python 2.7 and python 3.6 are available.

We bundle Python 2.7 with PyLith to insure the version of Python is binary compatible with the underlying C/C++ code. You should run “source setup.sh” in the top-level PyLith directory. Note that this script works for the bash shell. If you are using a different shell, you will need to adjust how the environment variables are set (but should not change the paths).

I’m sure ‘source setup.sh’ was run in the top-level Pylith directory, otherwise it would say “ERROR” “Source this script from the top-level PyLith directory:”.
And yes, I do use bash shell.
I’ve tried again, but the information still is
“Traceback (most recent call last):
File “/Users/XIE/Pylith/bin/Pylith”, line 25, in from pylith.apps.PyLithApp import PyLithApp ImportError: No module named pylith.apps.PyLithApp”

Something wrong with the python setting?

I don’t have the binary (or setup.sh) right now, but does it set PYTHONPATH? If so, what do you get for:
echo $PYTHONPATH

Your error messages (for reference)

Error message 1

Traceback (most recent call last):
File “/Users/Man/Pylith/pylith-2.2.2-darwin-10.13.6/bin/pylith”, line 25, in
from pylith.apps.PyLithApp import PyLithApp
ImportError: No module named pylith.apps.PyLithApp

Error message 2

“Traceback (most recent call last):
File “/Users/XIE/Pylith/bin/Pylith”, line 25, in from pylith.apps.PyLithApp import PyLithApp ImportError: No module named pylith.apps.PyLithApp”

Comments on your error messages

The two error messages you showed are similar but there are important differences. The first one is clearly using the PyLith binary in /Users/Man/PyLith/pylith-2.2.2-darwin-10.13.6. The second message is NOT using any PyLith install procedure we have created. It is using PyLith, but all of our methods for installing PyLith create a file pylith (all lower case). PyLith is in /Users/XIE/Pylith/bin/, so you definitely did something completely different (different user and different directory structure).

To help us help you, please follow these instructions precisely:

If you see output different than what I have shown here (except for the start of the absolute path), please post the commands you ran and all of the output for ALL of the steps up to that point (not just the one that is different). Addendum: Please also include the output of echo $PATH and echo $PYTHONPATH run in the bash shell after you do source setup.sh.

  1. Go to the top-level PyLith directory, pylith-2.2.2-darwin-10.13.6. Typing ls at the bash prompt should give you
bin/           include/       lib/           parametersgui/ setup.sh       share/         src/
  1. Type source setup.sh at the bash prompt. You should see
Ready to run PyLith.

Note: You must run source setup.sh in any new bash shell before running PyLith. That is, if you close your terminal and start a new one, you must run source setup.sh again.

  1. Type which pylith at the bash prompt. You should see something very similar to
/Users/baagaard/tmp/pylith/pylith-2.2.2-darwin-10.13.6/bin/pylith
  1. Type which nemesis at the bash prompt. You should see nemesis in the same directory as the pylith in step 3:
/Users/baagaard/tmp/pylith/pylith-2.2.2-darwin-10.13.6/bin/nemesis
  1. Type nemesis at the bash prompt and then (at the Python prompt) type import pylith.apps.PyLithApp, then pylith.apps.PyLithApp.__file__, then app = pylith.apps.PyLithApp.PyLithApp(). You should see
Python 2.7.16 (default, Dec  3 2019, 07:02:07)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pylith.apps.PyLithApp
>>> pylith.apps.PyLithApp.__file__
'/Users/baagaard/tmp/pylith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/pylith/apps/PyLithApp.pyc'
>>> app = pylith.apps.PyLithApp.PyLithApp()
  1. Type pylith --version. You should see something very similar to the following
Platform:
    Hostname: igskcicgltgm067
    Operating system: Darwin
    Kernel: 18.7.0
    Version: Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64
    Machine: x86_64
    Processor: i386

PyLith
    Release v2.2.2

PETSc
    Release v3.10.2

Spatialdata
    Release v1.10.0

MPI standard: 3.1, implementation: MPICH, version: 3.2.1
HDF5 version: 1.10.5
NetCDF version: 4.6.3
Proj version: 501

Python
    v2.7.16 of CPython compiled with GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)
    FIAT: v0.9.9 from /Users/baagaard/tmp/pylith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/FIAT
    spatialdata: v1.10.0 from /Users/baagaard/tmp/pylith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/spatialdata
    netCDF4: v1.5.0.1 from /Users/baagaard/tmp/pylith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/netCDF4-1.5.0.1-py2.7-macosx-10.13-intel.egg/netCDF4
    h5py: v2.9.0 from /Users/baagaard/tmp/pylith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/h5py-2.9.0-py2.7-macosx-10.13-intel.egg/h5py
    pyre: v0.8.1 from /Users/baagaard/tmp/pylith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/pythia-0.8.1.19-py2.7.egg/pyre
    numpy: v1.14.3 from /Users/baagaard/tmp/pylith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/numpy-1.14.3-py2.7-macosx-10.13-intel.egg/numpy

If you publish results based on computations with PyLith please cite the following:
(use --include-citations during your simulations to display a list specific to your computation):

@Manual{PyLith:software,
  title        = {PyLith v2.2.2},
  author       = {Aagaard, B. and Knepley, M. and Williams, C.},
  organization = {Computational Infrastructure for Geodynamics (CIG)},
  address      = {University of California, Davis},
  year         = {2017},
  doi         = {http://doi.org/10.5281/zenodo.886600}
}

@Manual{PyLith:manual,
  title        = {PyLith User Manual, Version 2.2.2},
  author       = {Aagaard, B. and Knepley, M. and Williams, C.},
  organization = {Computational Infrastructure for Geodynamics (CIG)},
  address      = {University of California, Davis},
  year         = {2017},
  note         = {http://www.geodynamics.org/cig/software/pylith/pylith\_manual-2.2.2.pdf}
}

@Article{Aagaard:Knepley:Williams:JGR:2013,
  author   = {Aagaard, B.~T. and Knepley, M.~G. and Wiliams, C.~A.},
  title    = {A domain decomposition approach to implementing fault slip in finite-element models of quasi-static and dynamic crustal deformation},
  journal  = {Journal of Geophysical Research Solid Earth},
  year     = {2013},
  volume   = {118},
  pages    = {3059--3079},
  doi      = {10.1002/jgrb.50217}
}

Everything is OK. Really thanks for your detailed reply.
The top level file name should be “pylith”, but not ‘Pylith’, I didn’t notice that.

Thanks:-)