cavalab / srbench

A living benchmark framework for symbolic regression
https://cavalab.org/srbench/
GNU General Public License v3.0
203 stars 75 forks source link

Use `micromamba` instead of `conda` #64

Closed lacava closed 10 months ago

lacava commented 2 years ago

One other suggestion: use micromamba instead of conda (mamba is a C++ rewrite of conda - it uses the same package servers but is much faster). The docker image mambaorg/micromamba which has micromamba built-in seems to work if all conda calls are replaced with micromamba. It's much faster for me!

Originally posted by @MilesCranmer in https://github.com/cavalab/srbench/issues/59#issuecomment-1017641513

MilesCranmer commented 2 years ago

I think mamba can be set up in the GitHub actions with:

          use-mamba: true

in the conda-incubator action. Source: https://github.com/conda-incubator/setup-miniconda#example-10-miniforge.

Once this is done, all that needs to be done is replace all conda commands with mamba. Maybe it could even be done by setting alias conda=mamba.

Alternatively, all conda commands could be replaced by $(CONDA) and then you can define any CONDA environment variable you'd like.

MilesCranmer commented 2 years ago

Two other comments to get more speed:

e.g.,

    runs-on: ${{ matrix.os }}
    strategy:
      matrix:
        julia-version: ['1.7.1']
        python-version: ['3.9']
        os: [ubuntu-latest]
        algorithm: ['PySR', 'Operon', ....

you would then pass as an argument ${{ matrix.algorithm }} to your install.sh and test_evaluate_models.py.

MilesCranmer commented 2 years ago

^ My first suggestion above is now a draft PR in #65

lacava commented 2 years ago

The test.yml should have each algorithm as part of a build matrix.

This is now the case since PR #75 .

However, I ended up not doing the builds in parallel because it resulted in several different environments that couldn't be easily reconciled into one. I could imagine it being cleaner to have containers for each algorithm with a base image that provides the suite; but at the moment I'm not set up to run it that way on the cluster due to constraints using docker. In addition, the image is huge and needs some work to bring it down to a reasonable size before containerizing each alg.

Regarding the original point, micromamba seems to work everywhere except with PySR during the install call. So for the moment mambaforge is being used in CI and the docker build.

folivetti commented 2 years ago

just to add to this issue. I tried installing srbench with a fresh Anaconda install on Manjaro Linux. I've only succeeded by first changing environment.yml and specifying python=3.7 and then using mamba to create the environment.

With conda it was taking ages to figure things out.

Also, I can confirm that using mamba PySR fails to install.

lacava commented 2 years ago

It looks like the latest release of conda uses libmamba for resolving dependences - is that what you're using @folivetti?

On Sun, Mar 20, 2022, 4:59 PM Fabricio Olivetti de Franca < @.***> wrote:

just to add to this issue. I tried installing srbench with a fresh Anaconda install on Manjaro Linux. I've only succeeded by first changing environment.yml and specifying python=3.7 and then using mamba to create the environment.

With conda it was taking ages to figure things out.

Also, I can confirm that using mamba PySR fails to install.

— Reply to this email directly, view it on GitHub https://github.com/cavalab/srbench/issues/64#issuecomment-1073347676, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABSGCGVRRXID5JUAVYAT4FLVA6GTXANCNFSM5MQJQKJA . You are receiving this because you authored the thread.Message ID: @.***>

folivetti commented 2 years ago

I don't think so, I had to actually install mamba

My steps:

It can be the case that after specifying python 3.7 in environment.yml would also solve the problem with conda, but haven't tried that since mamba was considerably faster

lacava commented 2 years ago

@folivetti can you share your conda version? we can edit environment.yml to specify python 3.7.

folivetti commented 2 years ago

@lacava

it's conda 4.12.0

hengzhe-zhang commented 11 months ago

Micromamba is truly excellent; it has been a lifesaver for me!

A recent update worth noting is that Conda now officially supports libmamba. By executing the following two commands, we can utilize mamba as the solver, significantly accelerating the package installation process.

conda install -n base conda-libmamba-solver
conda config --set solver libmamba
folivetti commented 11 months ago

Micromamba is truly excellent; it has been a lifesaver for me!

A recent update worth noting is that Conda now officially supports libmamba. By executing the following two commands, we can utilize mamba as the solver, significantly accelerating the package installation process.

conda install -n base conda-libmamba-solver
conda config --set solver libmamba

that sounds interesting. I'll test a clean install of srbench on a machine with very restricted user rights to see if it works.

lacava commented 10 months ago

we're using mamba in the tests and as @hengzhe-zhang said conda now ships with the solver.