[Trilinos-Users] PyTrilinos, library location info missing

Roberts, Nathan V. nvroberts at alcf.anl.gov
Thu Jan 8 10:33:26 MST 2015


Hi all,

I'm just getting started with PyTrilinos.  I do have Trilinos building with PyTrilinos, and I have put a line in my .bashrc like:

     export PYTHONPATH=$PYTHONPATH:<Trilinos-install-dir>/lib/python2.7/site-packages

I see in the User's Guide<http://trilinos.org/oldsite/packages/pytrilinos/UsersGuide.pdf> that since I built Trilinos with MPI, I shouldn't try to run in interactive mode (is that still true?), so I made a one-line script, pyTrilinosTest.py, that simply says:

from PyTrilinos import Epetra

I then run:

mpirun -np 1 python pyTrilinosTest.py

and get the following error:

Traceback (most recent call last):
  File "/Users/nroberts/Desktop/pyTrilinosTest.py", line 1, in <module>
    from PyTrilinos import Epetra
  File "/Users/nroberts/lib/trilinos/mpi-release-shared/lib/python2.7/site-packages/PyTrilinos/Epetra.py", line 80, in <module>
    _Epetra = swig_import_helper()
  File "/Users/nroberts/lib/trilinos/mpi-release-shared/lib/python2.7/site-packages/PyTrilinos/Epetra.py", line 76, in swig_import_helper
    _mod = imp.load_module('_Epetra', fp, pathname, description)
ImportError: dlopen(/Users/nroberts/lib/trilinos/mpi-release-shared/lib/python2.7/site-packages/PyTrilinos/_Epetra.so, 258): Library not loaded: libpytrilinos.11.dylib
  Referenced from: /Users/nroberts/lib/trilinos/mpi-release-shared/lib/python2.7/site-packages/PyTrilinos/_Epetra.so
  Reason: image not found

I have set LD_LIBRARY_PATH to include the directory that includes libpytrilinos.11.dylib.  Examining _Epetra.so with otool, I found that all the Trilinos libraries are listed without any path info.  I can resolve this manually by doing something like:

install_name_tool -change libpytrilinos.11.dylib /Users/nroberts/lib/trilinos/mpi-release-shared/lib/libpytrilinos.11.dylib /Users/nroberts/lib/trilinos/mpi-release-shared/lib/python2.7/site-packages/PyTrilinos/_Epetra.so

for each .so file and each library.  However, it seems likely that either there's something wrong with the way I built PyTrilinos, or that I'm missing something in the way I'm attempting to invoke it.  Is LD_LIBRARY_PATH the appropriate environment variable to set so that Python will find the referenced libraries?  Is there a way to build PyTrilinos so that the .so files include complete paths to the Trilinos libraries?

Thanks very much for any suggestions.

Regards,
Nate

P.S. In the PyTrilinos User's Guide<http://trilinos.org/oldsite/packages/pytrilinos/UsersGuide.pdf>, there's reference made to several PyTrilinos mailing lists.  However, I do not see these under https://software.sandia.gov/mailman/listinfo.  Do they still exist?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://software.sandia.gov/pipermail/trilinos-users/attachments/20150108/ae055797/attachment.html>


More information about the Trilinos-Users mailing list