Search code examples
pythonpytrilinostrilinos

trilinos does not install pytrilinos


I have compiled trilinos with pytrilinos but python does not import PyTrilinos.

This is what i have done, I configure the packages to install

cd Trilinos-build
cmake -D Trilinos_ENABLE_PyTrilinos:BOOL=ON -D BUILD_SHARED_LIBS:BOOL=ON -D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON ../trilinos-11.8.1-Source 

Then I installed with make

cd Trilinos-build
make -j1 install 

But when I try to use PyTrilinos, python says ther is no module

python
>>> from PyTrilinos import Epetra
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named PyTrilinos 

Solution

  • The solution that came out was to install the library in $HOME/trilinos-install

    cd $home
    mkdir trilinos-{install,build}
    cd trilinos-build
    
    cmake \
      -D CMAKE_BUILD_TYPE:STRING=RELEASE \
      -D CMAKE_INSTALL_PREFIX:STRING="$HOME/trilinos-install" \
      -D TPL_ENABLE_MPI:BOOL=ON \
      -D Trilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON \
      ../trilinos-11.8.1-Source 
    

    after that tell to python where is the modules

    export PYTHONPATH=$PYTHONPATH:~/trilinos-install/lib/python2.7/site-packages
    

    and specify where is installed pytrilinos a its libraries

    export LD_LIBRARY_PATH=~/trilinos-install/lib:$LD_LIBRARY_PATH
    

    Then install with make

    cd Trilinos-build
    make -j1 install
    

    and finally the module is recognized by python

    python
    >>> from PyTrilinos import Epetra