Error when running powerlaw_gendb.py

Hello,

I wanted to generate power-law viscoelastic material properties for my model. To test thing out I ran the example case by executing powerlaw_gendb.py inside the ~/PyLith/pylith-2.2.2-darwin-10.13.6/src/pylith-2.2.2/examples/3d/hex8/spatialdb/powerlaw directory but the following error appears:

Traceback (most recent call last):
File “/Users/Alpine/PyLith/pylith-2.2.2-darwin-10.13.6/bin/powerlaw_gendb.py”, line 32, in
class PowerLawApp(Application):
File “/Users/Alpine/PyLith/pylith-2.2.2-darwin-10.13.6/bin/powerlaw_gendb.py”, line 72, in PowerLawApp
from spatialdata.spatialdb.SimpleDB import SimpleDB
File “/Users/Alpine/PyLith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/spatialdata/spatialdb/SimpleDB.py”, line 23, in
from SpatialDBObj import SpatialDBObj
File “/Users/Alpine/PyLith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/spatialdata/spatialdb/SpatialDBObj.py”, line 24, in
from spatialdb import SpatialDB as ModuleSpatialDB
File “/Users/Alpine/PyLith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/spatialdata/spatialdb/spatialdb.py”, line 28, in
_spatialdb = swig_import_helper()
File “/Users/Alpine/PyLith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/spatialdata/spatialdb/spatialdb.py”, line 24, in swig_import_helper
_mod = imp.load_module(’_spatialdb’, fp, pathname, description)
ImportError: dlopen(/Users/Alpine/PyLith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/spatialdata/spatialdb/_spatialdbmodule.so, 2): Library not loaded: @executable_path/…/lib/libspatialdata.0.dylib
Referenced from: /Users/Alpine/PyLith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/spatialdata/spatialdb/_spatialdbmodule.so
Reason: unsafe use of @executable_path in /Users/Alpine/PyLith/pylith-2.2.2-darwin-10.13.6/lib/python2.7/site-packages/spatialdata/spatialdb/_spatialdbmodule.so with restricted binary

I installed pylith by simply doing “source setup.sh”. I wonder what causes this error and how can I resolve it?

Thanks in advance
Guo

This is a Mac security issue.

@knepley Do you know how to solve this?

The problem here is that the dependent library path (@executable_path/…/lib/libspatialdata.0.dylib) has not been rewritten in the spatialdata Python module. This happens during the installation of spatialdata. Something went wrong there. I would reinstall it.

Thanks,

 Matt
1 Like

I see the problem.

The first line of bin/powerlaw_gendb.py should be
#!/usr/bin/env nemesis
not
#!/usr/bin/env python

You will need to edit the file to fix this. This will give the correct path to libspatialdata.0.dylib. Be sure to invoke the script directly. That is, use powerlaw_gendb.py, not python powerlaw_gendb.py. This has been fixed in the master branch, but we didn’t do a new release just to fix this script.

1 Like

This works! Now it is producing .spatialdb file.

Thank you!