Skip to content
Connor Ward edited this page Oct 6, 2023 · 4 revisions

Why

It can be helpful to install Firedrake using a Python executable installed with pyenv rather than a system provided version. This is because:

  • When the system Python bumps a minor version (e.g. 3.10 -> 3.11) the Firedrake virtual environment will still work.
  • MacOS ships with a broken Python installation and the homebrew version also does not always work.

How

To install pyenv (assuming MacOS with homebrew installed) one needs to:

  1. Install build dependencies
  2. Install pyenv. Note that the pyenv provided by homebrew should not be installed. At the time of writing it unconditionally injects CFLAGS and LDFLAGS that will break components like petsc4py and mpi4py if you have a homebrew-installed OpenMPI.
  3. Set PYENV_ROOT and PATH
    $ export PYENV_ROOT=$HOME/.pyenv
    $ export PATH=$PYENV_ROOT/bin:$PATH
    
  4. Initialise the shell
    $ eval "$(pyenv init -)"
    
    Note that this command is optional. One can instead find the installed Python versions under $(pyenv root)/versions. See here for more information.
  5. Install a Python version (here 3.11)
    $ pyenv install 3.11
    
  6. Set this Python as the default for this shell (only if using pyenv init)
    $ pyenv shell 3.11
    
  7. Run firedrake-install, python will resolve to the correct executable
    $ python firedrake-install <args>
    

Note that the above instructions are equivalent to those found here.

You might also find it helpful to install the Firedrake virtual environment in such a way that pyenv can easily find it. You can do that by adding an argument to the install script: $ python firedrake-install <args> --venv-name=$(pyenv root)/versions/firedrake After the installation succeeds, you can activate the Firedrake virtual environment with pyenv shell firedrake.

Home

Building locally
Tips

Install Frequently Asked Questions

Running on HPC

Users

Developers Notes

Minutes and agenda of Firedrake meetings


Policies and procedures

Gravity wave scaling

Merge Complex Sprint

Reading Group

Firedrake 2021 Planning Meetings
Clone this wiki locally