Skip to content

Commit

Permalink
Recommend install with micromamba (#56)
Browse files Browse the repository at this point in the history
* chore(deps): update pydashi to 2.0.0

* Recommend micromamba install exclusively

* chore(ci): install with micromamba

* Install dev deps in ci

* disable env cache

caching does not actually speed up micromamba create

* squash DeprecationWarning: Conversion of an array with ndim > 0 to a scalar is deprecated
  • Loading branch information
jvansanten authored May 6, 2024
1 parent 9a8907c commit 1ba1cd5
Show file tree
Hide file tree
Showing 8 changed files with 5,410 additions and 4,251 deletions.
23 changes: 4 additions & 19 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,27 +28,12 @@ jobs:
- uses: actions/checkout@v2

- name: Cache conda pacakges
uses: actions/cache@v2
env:
# Increase this value to reset cache if etc/example-environment.yml has not changed
CACHE_NUMBER: 0
with:
path: ~/conda_pkgs_dir
key:
conda-${{ steps.detect.outputs.platform }}-${{ env.CACHE_NUMBER }}-${{hashFiles('conda-lock.yml') }}

- name: Set up conda environment
uses: conda-incubator/setup-miniconda@v2
uses: mamba-org/setup-micromamba@v1
with:
auto-update-conda: false
activate-environment: test-env
environment-file: conda-${{ steps.detect.outputs.platform }}.lock

- name: Install pip deps
run: |
cat conda-${{ steps.detect.outputs.platform }}.lock | awk '/^# pip/ {print substr($0,7)}' > requirements.txt
pip install --no-deps -r requirements.txt
environment-file: conda-lock.yml
environment-name: ci
create-args: --category main dev

- name: Install project
env:
Expand Down
32 changes: 11 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,19 @@ sensitivities in different units depending on context.
## Installation

The way to install `toise` and its depedencies is
with `conda`. If you do not already have `miniconda` on your system, obtain the
installer from https://conda.io/miniconda.html, and install in a location of
your choice, e.g.:
with [`micromamba`](https://mamba.readthedocs.io/en/latest/installation/micromamba-installation.html). If you do not already have `micromamba` on your system,

```sh
sh ./Miniconda3-latest-Linux-x86_64.sh -p $CONDA_PREFIX
```console
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)
```

replacing `CONDA_PREFIX` with the prefix you chose.
or, os macOS with Homebrew:

```console
brew install micromamba
```

Then, obtain `toise`:
Next, obtain `toise`:

```sh
git clone [email protected]:icecube/toise.git
Expand All @@ -37,21 +39,9 @@ git clone [email protected]:icecube/toise.git
Then, from the `toise` source directory, create a new environment:
```sh
cd toise
$CONDA_PREFIX/bin/conda env create -n toise --file environment.yml
```

This will also download the required data tables.

The above will install the latest available versions of all dependencies. You can also install exactly the versions that were most recently tested with:
```sh
cd toise

PLATFORM_LOCKFILE=$(conda info --json | jq -r '"conda-\(.platform).lock"')
conda create -n toise --file $PLATFORM_LOCKFILE
cat $PLATFORM_LOCKFILE | awk '/^# pip/ {print substr($0,7)}' > requirements.txt
conda run -n toise pip install -r requirements.txt -e .
micromamba create -n toise --file conda-lock.yml
conda run -n toise pip install -e .
```
This should be much faster, as it does not have to solve for compatible versions of all the dependencies. If you do not have `jq` installed, you can set `PLATFORM_LOCKFILE` by hand to e.g. `conda-osx-64.lock`.

If you have a Jupyter notebook installation from another conda environment, you should now be able to open this notebook in Jupyter and select the "Python [conda env:miniconda3-toise]" kernel.

Expand Down
151 changes: 0 additions & 151 deletions conda-linux-64.lock

This file was deleted.

Loading

0 comments on commit 1ba1cd5

Please sign in to comment.