Skip to content

Commit 6b3c173

Browse files
connorjwardJHopeCollinsleo-collins
authored andcommitted
Improve install docs (#4461)
* Improve install docs * Be really aggressive about purging the pip cache as this is a very common issue for users. * Mention that macOS needs Xcode. * Add venv instructions to dev install. --------- Co-authored-by: Josh Hope-Collins <joshua.hope-collins13@imperial.ac.uk> Co-authored-by: Leo Collins <leocollins511@gmail.com>
1 parent e648792 commit 6b3c173

File tree

1 file changed

+42
-14
lines changed

1 file changed

+42
-14
lines changed

docs/source/install.rst

Lines changed: 42 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,9 @@ Prerequisites
4949
-------------
5050

5151
On Linux the only prerequisite needed to install Firedrake is a suitable version
52-
of Python (3.10 or greater). On macOS it is important that homebrew_ is installed
53-
and that the homebrew-installed Python is used instead of the system one.
52+
of Python (3.10 or greater). On macOS it is important that homebrew_ and Xcode_
53+
are installed and up to date and that the homebrew-installed Python is used
54+
instead of the system one.
5455

5556

5657
.. _firedrake_configure:
@@ -177,6 +178,25 @@ install Firedrake. To do this perform the following steps:
177178
This is optional but strongly recommended to avoid polluting your system Python
178179
environment.
179180

181+
#. Purge the pip cache::
182+
183+
$ pip cache purge
184+
185+
This is also optional but strongly recommended as some cached pip packages
186+
may be linked against old or missing libraries and hence will break your
187+
installation. For a lighter-weight alternative you could run some or all
188+
of the following::
189+
190+
$ pip cache remove mpi4py
191+
$ pip cache remove petsc4py
192+
$ pip cache remove h5py
193+
$ pip cache remove slepc4py
194+
$ pip cache remove libsupermesh
195+
$ pip cache remove firedrake
196+
197+
Noting that this list may not be exhaustive.
198+
199+
180200
#. Set any necessary environment variables. This can be achieved using
181201
``firedrake-configure``::
182202

@@ -197,8 +217,6 @@ install Firedrake. To do this perform the following steps:
197217

198218
#. Install Firedrake::
199219

200-
$ pip cache remove petsc4py
201-
$ pip cache remove firedrake
202220
$ pip install --no-binary h5py 'firedrake[check]'
203221

204222
.. note::
@@ -293,15 +311,20 @@ Missing symbols post install
293311

294312
If the installation completes but then you get errors regarding missing symbols
295313
when you import Firedrake this is usually a sign that one of the Python bindings
296-
packages used by Firedrake (h5py, mpi4py, petsc4py, slepc4py) is linked against
297-
the wrong compiled library. This is usually caused by issues with caching.
314+
packages used by Firedrake (h5py, mpi4py, petsc4py, slepc4py), or Firedrake
315+
itself, is linked against the wrong compiled library. This is usually caused
316+
by issues with caching.
298317

299-
To resolve the problem you should first remove any existing cached packages::
318+
To resolve the problem we recommend removing your virtual environment, purging
319+
the cache and then :ref:`attempting another installation<install_firedrake>`:
300320

301-
$ pip uninstall -y h5py mpi4py petsc4py slepc4py
302-
$ pip cache purge
321+
.. code-block:: bash
303322
304-
before re-running the instruction to install Firedrake.
323+
$ deactivate # needed if venv-firedrake is currently activated
324+
$ rm -r venv-firedrake
325+
$ pip cache purge
326+
$ python3 -m venv venv-firedrake
327+
# etc
305328
306329
Unable to configure PETSc on macOS
307330
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -367,10 +390,9 @@ To install Firedrake with SLEPc support you should:
367390

368391
$ export SLEPC_DIR=$PETSC_DIR/$PETSC_ARCH
369392

370-
#. Continue with the installation as normal but remove slepc4py from the pip cache
371-
and install Firedrake with the ``slepc`` optional dependency. For example::
393+
#. Continue with the installation as normal but install Firedrake with the
394+
``slepc`` optional dependency. For example::
372395

373-
$ pip cache remove slepc4py
374396
$ pip install --no-binary h5py 'firedrake[check,slepc]'
375397

376398
VTK
@@ -551,11 +573,16 @@ should be followed:
551573

552574
$ export $(python3 firedrake-configure --show-env)
553575

576+
#. Create and activate a virtual environment::
577+
578+
$ python3 -m venv venv-firedrake
579+
$ . venv-firedrake/bin/activate
580+
554581
#. Install petsc4py and Firedrake's other build dependencies:
555582

556583
.. code-block:: text
557584
558-
$ pip cache remove petsc4py
585+
$ pip cache purge
559586
$ pip install $PETSC_DIR/src/binding/petsc4py
560587
$ pip install -r ./firedrake/requirements-build.txt
561588
@@ -584,6 +611,7 @@ package.
584611
.. _discussion: https://github.com/firedrakeproject/firedrake/discussions
585612
.. _issue: https://github.com/firedrakeproject/firedrake/issues
586613
.. _homebrew: https://brew.sh/
614+
.. _Xcode: https://developer.apple.com/xcode/
587615
.. _PETSc: https://petsc.org/
588616
.. _petsc4py: https://petsc.org/release/petsc4py/reference/petsc4py.html
589617
.. _venv: https://docs.python.org/3/tutorial/venv.html

0 commit comments

Comments
 (0)