Skip to content

Commit d3ab2da

Browse files
committed
Switch to Miniforge and update REAME
1 parent 4b4258b commit d3ab2da

File tree

2 files changed

+28
-25
lines changed

2 files changed

+28
-25
lines changed

docker/README.md

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ OpenFermion (or any of its plugins) using the standard procedure.
1616

1717
- Git
1818
- Python 3.12
19-
- [Miniconda](https://www.anaconda.com/docs/getting-started/miniconda/main)
19+
- [Miniforge](https://github.com/conda-forge/miniforge)
2020
- [OpenFermion](https://github.com/quantumlib/OpenFermion)
2121
- [Cirq](https://github.com/quantumlib/Cirq)
2222
- [Psi4](http://www.psicode.org)
@@ -29,27 +29,27 @@ OpenFermion (or any of its plugins) using the standard procedure.
2929
## Setting up Docker for the first time
3030

3131
The Dockerfile is based on the [Ubuntu image](https://hub.docker.com/_/ubuntu) (ver. 22.04).
32-
It creates a Python (ver. 3.12) virtual environemnt (named `fermion`) using Miniconda and installs all dependencies within it. Psi4 is installed with a conda [command](https://psicode.org/installs/v191/).
33-
The default configuration uses the Miniconda installer (ver. 25.5.1-1) for Python 3.12 on Linux `aarch64` architecture.
32+
It creates a Python (ver. 3.12) virtual environemnt (named `fermion`) using Miniforge and installs all dependencies within it. Psi4 is installed with a conda [command](https://psicode.org/installs/v191/).
33+
The default configuration uses the latest Miniforge installer on Linux `aarch64` architecture.
3434

3535
### Customizing the Environment
36-
You can manually edit the Dockerfile if you need to set up a different development environment (e.g., change the Ubuntu, Python, Miniconda, or Psi4 version).
36+
You can manually edit the Dockerfile if you need to set up a different development environment (e.g., changing the Ubuntu, Python, Miniforge, or Psi4 version).
3737

3838
If your local machine builds Linux `x86_64` architecture with the Dockerfile, the `wget` command
39-
for the Miniconda installer (Line 40 in the Dockerfile)
39+
for the Miniforge installer (Line 40 in the Dockerfile)
4040
```
41-
wget https://repo.anaconda.com/miniconda/Miniconda3-py312_25.5.1-1-Linux-aarch64.sh -O ~/miniconda3/miniconda.sh && \
41+
wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh"
4242
```
4343
must be changed to
4444
```
45-
wget https://repo.anaconda.com/miniconda/Miniconda3-py312_25.5.1-1-Linux-x86_64.sh -O ~/miniconda3/miniconda.sh && \
45+
wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-x86_64.sh"
4646
```
47-
You can check other Miniconda installers [here](https://repo.anaconda.com/miniconda/).
47+
You can check other Miniforge installers [here](https://github.com/conda-forge/miniforge?tab=readme-ov-file#requirements-and-installers).
4848

4949
### Building Docker Image
5050
You first need to install [Docker](https://www.docker.com/).
5151
Once Docker is setup, one can navigate to the folder containing the
52-
Dockerfile for building the OpenFermion image (docker/dockerfile) and run
52+
Dockerfile for building the OpenFermion image (/docker/dockerfile) and run
5353

5454
```
5555
docker build -t openfermion_docker .
@@ -59,15 +59,21 @@ where "openfermion_docker" is just an arbitrary name for our docker image.
5959
Building the Dockerfile starts from a base image of Ubuntu and then installs
6060
OpenFermion, its plugins, and the necessary applications needed for running these
6161
programs. This is a fairly involved setup and will take some time
62-
(perhaps up to thirty minutes depending on the computer) and disk space (several gigabytes). Once installation has completed, run the image with
62+
(perhaps up to thirty minutes depending on the computer) and disk space (several gigabytes).
6363

64+
### Running the Container
65+
Once the image has been built, run the image with
6466
```
6567
docker run -it --name openfermion_container -v $(pwd):/root/workspace openfermion_docker
6668
```
67-
where "openfermion_container" is an arbitrary choice for the name of our docker container. This command will mount your current local directory to `/root/workspace` inside the running container. You can activate the virtual environment `fermion` in the container with
69+
where "openfermion_container" is an arbitrary choice for the name of our docker container. This command will mount your current local directory to `/root/workspace` inside the running container.
70+
By default, the virtual environment `fermion` is automatically activated in the running container.
71+
After installing the `Dev Containers` extension in Visual Studio Code,
72+
you can open the container with the following option:
6873
```
69-
source activate fermion
74+
Command Palette -> Dev Containers: Attach to Running Container..
7075
```
76+
and select `openfermion_container` for this example.
7177

7278
An alternative way of loading files onto the Docker container is through
7379
remote repos such as GitHub. Git is installed in the Docker image.

docker/dockerfile

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ USER root
1919
WORKDIR /root/workspace
2020
COPY . /root/workspace
2121

22-
# Set PATH for miniconda
23-
ENV PATH=/root/miniconda3/bin:$PATH
22+
# Set PATH for miniforge
23+
ENV PATH="/root/conda/bin:${PATH}"
2424
# Set PATH for pyscf
2525
ENV PYTHONPATH=/root/pyscf
2626

@@ -34,17 +34,11 @@ RUN apt-get update && \
3434
liblapack-dev \
3535
curl
3636

37-
# Install miniconda for python 3.12, Linux aarch
38-
# https://www.anaconda.com/docs/getting-started/miniconda/install#quickstart-install-instructions
39-
RUN mkdir -p ~/miniconda3 && \
40-
wget https://repo.anaconda.com/miniconda/Miniconda3-py312_25.5.1-1-Linux-aarch64.sh -O ~/miniconda3/miniconda.sh && \
41-
bash ~/miniconda3/miniconda.sh -b -u -p ~/miniconda3 && \
42-
rm ~/miniconda3/miniconda.sh && \
43-
/bin/bash -c "source ~/miniconda3/bin/activate" && \
44-
conda init --all && \
45-
# To accept a channel's Terms of Service
46-
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/main && \
47-
conda tos accept --override-channels --channel https://repo.anaconda.com/pkgs/r && \
37+
# Install miniforge https://github.com/conda-forge/miniforge?tab=readme-ov-file#as-part-of-a-ci-pipeline
38+
RUN wget -O Miniforge3.sh "https://github.com/conda-forge/miniforge/releases/latest/download/Miniforge3-Linux-aarch64.sh" && \
39+
bash Miniforge3.sh -b -p "${HOME}/conda" && \
40+
conda init bash && \
41+
conda update -n base -c conda-forge conda && \
4842
# Create virtual env (fermion) with installing Psi4
4943
conda create -n fermion psi4 python=3.12 -c conda-forge -y && \
5044
conda install -n fermion pip -y && \
@@ -58,3 +52,6 @@ RUN mkdir -p ~/miniconda3 && \
5852
cd build && \
5953
cmake .. && \
6054
make
55+
56+
# Activate venv (fermion)
57+
RUN echo "conda activate fermion" >> ~/.bashrc

0 commit comments

Comments
 (0)