-----Ursprüngliche Nachricht----- Von: firedrake-bounces@imperial.ac.uk [mailto:firedrake- bounces@imperial.ac.uk] Im Auftrag von Lawrence Mitchell Gesendet: 05 April 2017 16:19 An: firedrake@imperial.ac.uk Betreff: Re: [firedrake] Using own PETSc with --honour-petsc-dir
On 05/04/17 15:16, Buesing, Henrik wrote:
Yes, I'm setting PETSC_DIR and PETSC_ARCH. Then I execute
mpiexec -n 16 python 2pinjection.py (-all the petsc options). I checked with echo $PETSC_DIR and $PETSC_ARCH.
Hmmm, the code that raises this error is just:
import os def get_petsc_dir(): try: arch = '/' + os.environ.get('PETSC_ARCH', '') dir = os.environ['PETSC_DIR'] return (dir, dir + arch) except KeyError: try: import petsc return (petsc.get_petsc_dir(), ) except ImportError: sys.exit("""Error: Could not find PETSc library.
Set the environment variable PETSC_DIR to your local PETSc base directory or install PETSc from PyPI: pip install petsc""")
So let's check that we can actually do that:
Can you do:
$ export PETSC_DIR=/path/to/petsc/dir $ expect PETSC_ARCH=your-petsc-arch
$ mpiexec -n 16 python -c "import os; print os.environ['PETSC_DIR'],os.environ.get('PETSC_ARCH', 'not found')"
Yes, I am getting: Traceback (most recent call last): File "<string>", line 1, in <module> File "/rwthfs/rz/cluster/work/hb111949/Firedrake/firedrake-own-petsc/firedrake/lib64/python2.7/UserDict.py", line 23, in __getitem__ raise KeyError(key) KeyError: 'PETSC_DIR'