uafgeotools / mtuq

moment tensor uncertainty quantification
BSD 2-Clause "Simplified" License
65 stars 22 forks source link

Update instructions to use mamba (or libmamba) solver #234

Closed SeismoFelix closed 5 months ago

SeismoFelix commented 8 months ago

I sometimes struggle with the installation of MTUQ. After making conda env update --file env.yaml, the solving environment output stays forever ...

Collecting package metadata (repodata.json): done Solving environment: -

The last time it worked, the installation took 15 minutes.

I have seen that this is a common issue that the conda classic solver is facing, and it is becoming a bottleneck for conda conventional installations.

An efficient alternative could be to keep using conda but setting libmamba as the default solver. In this approach, the first step should be installing libmamba and follow the installation instructions as they are given in MTUQ.

I could install libmamba, but I got an error when updating the environment:

$ conda env update --file env.yaml

CondaValueError: You have chosen a non-default solver backend (libmamba) but it was not recognized. Choose one of: classic

I tried another option, using mamba directly. First, by installing mamba and then replacing conda command with mamba one:

mamba env update --file env.yaml and mamba install 'pygmt=0.9'

Unfortunately, this option did not work either. Only installing pygmt worked but env update stayed frozen.

I would appreciate some adaptions for making mamba work for installing MTUQ. I guess this improvement can speed up the installation time

Thanks.

thurinj commented 8 months ago

Hi Felix,

I actually switched to using Mamba not so long ago, and I installed it with the following (on conda base environment):

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

I was able to install mtuq with it, even using the solver manually with:

$ conda create -n mtuq_mamba python=3 --solver=libmamba
$ conda activate mtuq_mamba
$ conda env update --file env.yaml --solver=libmamba

The version of Mamba installed on my system are:

conda                     23.9.0           py38h50d1736_0    conda-forge
conda-libmamba-solver     23.7.0             pyhd8ed1ab_0    conda-forge
libmamba                  1.4.2                h9d281b0_0    conda-forge
libmambapy                1.4.2            py38h46face1_0    conda-forge

What version of conda and mamba are you using? Hopefully we can make it work on your system too, because it is that much faster!

(Here is another link for people that might want to get started: https://conda.github.io/conda-libmamba-solver/getting-started/

rmodrak commented 8 months ago

Maybe something to add here? https://uafgeotools.github.io/mtuq/install/issues.html

SeismoFelix commented 8 months ago

Thanks Julien. Ryan, installing issues could be a good place, but to me, the best place is in the installing instructions as an alternative (a very quicker one) to the conventional conda procedure.

rmodrak commented 7 months ago

Some draft notes talking about Python distributions and libmamba

https://github.com/rmodrak/mtuq/blob/master/docs/install/issues.rst

Following up on Felix's suggestion, does anyone know by chance if libmamba can be specified via the conda env file?

rmodrak commented 6 months ago

All the above may now be outdated:

https://conda.org/blog/2023-11-06-conda-23-10-0-release

rmodrak commented 6 months ago

@SeismoFelix @thurinj This is sufficient now I think, right?

https://uafgeotools.github.io/mtuq/install/issues.html#speeding-up-conda-installs