These are the steps that worked for me to install icepack on a 2018 Mac air running iOS 13.2.1 (22D68).
It works to first install firedrake, then install icepack.
I also found that a few extra steps were required to install firedrake compared to the instructions found on the project website.
If you have not got it on your system already, install homebrew from here https://brew.sh/
I ran into an issue with a fortran compiler, which led me to update xcode command line tools, following guidelines here.
Comment out all lines in .zshrc and/or .bash_profile which mention conda/anaconda prior to installation.
Even though I downloaded the installation script relatively recently (a few weeks ago), it was out of date after firedrakeproject/firedrake#2838. So make sure you have the latest version of the script:
curl -O https://raw.githubusercontent.com/firedrakeproject/firedrake/master/scripts/firedrake-install
brew install python
The MacOS version of python is apparently not good for installing firedrake, so make sure that when you type python into the terminal you are getting the homebrew version. Ensure this by adding
export PATH="/usr/local/opt/python/libexec/bin:$PATH"
to .zshrc, as suggested here. I think adding the same line to .bash_profile will work the same way if your terminal is set up to use bash.
python firedrake-install
then wait more than two hours (at least on my 2018 macbook air).
Follow the steps on the firedrake website to test the installation:
Start the virtual environment:
. /Users/jkingslake/firedrake/bin/activate
change directory to the correct place to run the tests:
cd $VIRTUAL_ENV/src/firedrake
run the tests:
pytest tests/regression/ -k "poisson_strong or stokes_mini or dg_advection"
Icepack is installed as a package on top of firedrake:
change directory back to where you installed firedrake and run
python firedrake/bin/firedrake-update --install icepack
Comment out the last two lines in $VIRTUAL_ENV/src/icepack/requirements.txt, i.e. open the file and change the last two lines to
#roltrilinos[opt]==0.0.9
#ROL[opt]==0.0.16
Also, while you have that file open, add 'jupyterlab' to the end of the list of packages. Then install them by running
cd $VIRTUAL_ENV/src/icepack
pip install -r requirements.txt
Install gmsh:
brew install gmsh
pytest -s test/ice_shelf_test.py
These steps should have successfully installed icepack. A good first step in learning how to use the software is to work through the tutorial notebooks:
cd $VIRTUAL_ENV/src/icepack/notebooks
jupyter-lab
The current version of icepack seems to be broken (12/10/2023) because firedrake comes with an older version of icepack installed which causes pathing issues. To get around this we can use a docker image with an older version of firedrake already installed. We will follow the steps listed on the icepack install page but switch out the image for an older image. The following steps were performed on Ubuntu 22.04.3 LTS.
Follow steps listed on the docker website
The method under Install using the apt repository
was used which seems to work fine.
Instruction for Macs with Apple silicon or intel chips can be found here
A Dockerfile contains a set of instructions which are followed so that we get an image which has everything we require. In this instance, we will create a dockerfile that uses an image with an older firedrake installation (from 09/2023) and install icepack on top of it. Copy paste the contents below into a textfile and name it Dockerfile
FROM firedrakeproject/firedrake-vanilla:2023-09
RUN sudo apt update && sudo apt install patchelf
RUN source firedrake/bin/activate && \
pip install git+https://github.com/icepack/Trilinos.git && \
pip install git+https://github.com/icepack/pyrol.git && \
git clone https://github.com/icepack/icepack.git && \
pip install --editable ./icepack && \
pip install jupyter lab
Run
docker build --tag icepack-image <directory>
<directory>
is the folder where the Dockerfile lives on your machine. If this give a permission denied error, run using sudo
. Do this for all future docker commands if required. This link might be useful if you do not want to use sudo
.
Interactively run the image using
docker run \
--interactive --tty \
--publish 8888:8888 \
icepack-image
if you want to access a local folder inside the image refer to the icepack installation page.
Activate the firedrake environment
source ~/firedrake/bin/activate
Run test script
pytest -s icepack/test/ice_shelf_test.py
Make sure firedrake environment is activated. To ensure we use this environment in jupyter lab
pip install ipykernel
python -m ipykernel install --user --name=firedrake
install gmsh
since they are used by many tutorials
sudo apt-get install gmsh
run jupyter lab
jupyter lab --ip 0.0.0.0 --no-browser
if that gives an error try
~/.local/bin/jupyter lab --ip 0.0.0.0 --no-browser
The server will print a bunch of things, at the end of which will be a URL. If you paste that URL into your browser you should have access from your host system to the notebook server that's now running in the container.