1. Installation of Firedrake#
See the official document Install
Using Docker with the image provided by the Firedrake project is recommended.
To install Firedrake, the computer should have access to the internet (including github.com and pypi).
1.1. Some Notes on Installation#
1.1.1. Install petsc with external packages pre-downloaded into a directory#
Sometimes, some of the packages that petsc depends on cannot be downloaded automatically. We can add the option
--with-packages-download-dir=<path/to/petsc/packages>
to command configure of petsc to obtain the list of required packages.
Then download these packages manually and put them into the path.
Afterwards, configure it again with the above option.
The python script download_petsc_pkgs.py can be used to download the packages.
Save the output of petsc configure to a file, for example pkgs_info.txt.
Then run the following command to download packages:
python3 download_petsc_pkgs.py -d <path/to/petsc/packages> pkgs_info.txt
1.1.2. Using Firedrake in JupyterLab (installed outside the Firedrake env)#
Install
jupyterlabpython3 -m pip install jupyterlab
You may need to add
$HOME/.local/binto the environment variablePATH:export PATH=$PATH:$HOME/.local/bin
Configure jupyterlab
Generate config file for customizing jupyter lab:
jupyter lab --generate-config
Set password for jupyter lab:
jupyter lab password #
Configure Browser
In wsl-ubuntu, configure the browser like this:
export BROWSER="/path/to/chrome/or/firefox"
An example of chrome:
export BROWSER='/mnt/c/Program Files/Google/Chrome/Application/chrome.exe'
Now, you can type
jupyter-labto start jupyter. You will see jupyter in browser.Configure kernels
Activate env:
$ source /your/env/path/activate
Add kernels:
(your-venv)$ ipython kernel install --name "local-venv" --user
The output should look like:
Installed kernelspec local-venv in /path/to/kernels/local-venvwhere the path
/path/to/kernels/local-venvwill have a different name in your environment.Also, we can find the kernelspec path by running
jupyter kernelspec list, which will output all available kernels with their paths.Now we need to check the python path in
kernel.json, which is located in the above path. Make sure it is the python in your env. Otherwise, correct it.Add environment variables to
kernel.json:[1]An example of
kernel.json:{ "argv": [ "/home/yzz/firedrake/real-int32-debug/bin/python", "-m", "ipykernel_launcher", "-f", "{connection_file}" ], "env": { "OMP_NUM_THREADS": "1", "PATH": "/home/yzz/firedrake/real-int32-debug/bin:${PATH}" }, "display_name": "firedrake-real-int32", "language": "python", "metadata": { "debugger": true } }