Dear Emmanuel,

 

Firedrake depends on PETSc, and in particular on PETSc built with certain features enabled. For most users, the right thing to do is to let Firedrake build PETSc itself so that a known good version of PETSc is used and all the right things are built in. However, there are some users who have particular reasons why they want or need to use a PETSc other than the one Firedrake builds. This means that there are two correct use modes for Firedrake:

 

  1. Firedrake installed using its own build-in PETSc. The user does not pass --honour-petsc-dir to the installer, and the user ensures that the environment variables PETSC_DIR and PETSC_ARCH are not set, both when installing Firedrake and when using Firedrake. This is what most users should do.
  2. Firedrake is being told to use an external PETSc. The user sets PETSC_DIR and PETSC_ARCH in order to specify the location of PETSc, and passes --honour-petsc-dir to the installer. This is a specialist option.

 

What appears to have happened in your case is that you have PETSC_DIR and PETSC_ARCH set in your default environment. You unset these when running the installer, which is the right thing to do. Then when you ran “python3 sdhm_monolithic.py”, the PETSC_DIR environment variable was set. This sends conflicting signals to Firedrake: on the one hand you built Firedrake saying you wanted to use the internally built PETSc, on the other hand you are running Firedrake with environment variables set which tell Firedrake to use a different PETSc. Firedrake therefore errors and tells you to choose one of those two options. It is almost certainly the right thing to do to simply unset PETSC_DIR and PETSC_ARCH before running Firedrake.

 

Regards,

 

David

 

From: <firedrake-bounces@imperial.ac.uk> on behalf of Emmanuel Yarleque Medina <eyarmed@gmail.com>
Date: Saturday, 4 April 2020 at 22:01
To: firedrake <firedrake@imperial.ac.uk>
Subject: [firedrake] Help me

 

Hi users,

I have a problem installing Firedrake with Petsc.
Initially install using the following steps:
curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/master/scripts/firedrake-install
unset PYTHONPATH; unset PETSC_DIR; unset PETSC_ARCH;
python3 firedrake-install

and it works on installation, only when testing my code with the discontinuous Galerkin hybrid method (HDG) it gave the following error:



(firedrake) hpc@hpc:~/Downloads/Exemplos_Firedrake/HDG/poroso/MWE/SDHM$ python3 sdhm_monolithic.py
Traceback (most recent call last):
  File "sdhm_monolithic.py", line 1, in <module>
    from firedrake import *
  File "/home/hpc/firedrake/src/firedrake/firedrake/__init__.py", line 8, in <module>
    raise ImportError("PETSC_DIR is set, but you did not install with --honour-petsc-dir.\n"
ImportError: PETSC_DIR is set, but you did not install with --honour-petsc-dir.
Please unset PETSC_DIR (and PETSC_ARCH) before using Firedrake.









try installing with python3 firedrake-install --honor-petsc-dir, but I have the following error:
hpc @ hpc: ~ $ python3 firedrake-install --honor-petsc-dir
Running firedrake-install --honor-petsc-dir
The --honor-petsc-dir is set, but PETSC_DIR environment variable is
not defined. If you have compiled PETSc manually, set PETSC_DIR
(and optionally PETSC_ARCH) variables to point to the build directory.

could you help me on how to solve that problem, please.



Best regards,

Emmanuel Y. Medina

Ph.D Student in UFJF-Brazil