[Trilinos-Users] [EXTERNAL] PyTrilinos, library location info missing

Bill Spotz wfspotz at sandia.gov
Thu Jan 8 12:00:26 MST 2015


Hi Nate,

As far as running interactively on one processor, I have had luck with OpenMPI.  I am also working with Enthought so that in the future, you can run ipython interactively and control an engine of multiple processors with distributed PyTrilinos objects.

As a first test, you can try this in the build directory:

  $ cd <Trilinos-build-dir>/packages/PyTrilinos/src
  $ mpirun -np 1 python -e "from PyTrilinos import Epetra"

(With OpenMPI, "mpirun -np 1" is unnecessary, and I can run python interactively.)  You could also do

  $ cd <Trilinos-build-dir>/packages/PyTrilinos
  $ ctest

and see how the PyTrilinos tests progress.  If this works, then you know it is a problem associated with where you have installed the dynamic libraries.  It is true that the *.py,*.pyc and _*.so files generated by PyTrilinos are going to be installed in your <Trilinos-install-dir>/lib/python2.7/site-packages directory, but the Trilinos lib*.dylib files (including libpytrilinos.dylib, I think) are going to be installed elsewhere.

Since your home directory is /Users/nroberts, it LOOKS to me like you are on a Mac, in which case you need to set DYLD_LIBRARY_PATH instead of LD_LIBRARY_PATH to find dynamic libraries.

The mailing lists still exist.

-Bill

On Jan 8, 2015, at 10:33 AM, Roberts, Nathan V. <nvroberts at alcf.anl.gov> wrote:

> 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 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, 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?
> _______________________________________________
> Trilinos-Users mailing list
> Trilinos-Users at software.sandia.gov
> https://software.sandia.gov/mailman/listinfo/trilinos-users

** Bill Spotz                                              **
** Sandia National Laboratories  Voice: (505)845-0170      **
** P.O. Box 5800                 Fax:   (505)284-0154      **
** Albuquerque, NM 87185-0370    Email: wfspotz at sandia.gov **



More information about the Trilinos-Users mailing list