mamba-org / mamba

The Fast Cross-Platform Package Manager
https://mamba.readthedocs.io
BSD 3-Clause "New" or "Revised" License
6.78k stars 348 forks source link

Implement `micromamba env update` #1455

Open jonashaag opened 2 years ago

jonashaag commented 2 years ago

It would be nice to have a way in Micromamba to update an env from an environment.yml. In Mamba this works by mamba env update -n X -f environment.yml.

wolfv commented 2 years ago

I think we can use the current micromamba update -f myenv.yml for that.

We can add a command line option to --prune-to-specs.

jonashaag commented 2 years ago

micromamba update -f myenv.yml seems to ignore myenv.yml.

wolfv commented 2 years ago

I am realizing that maybe that is the desired behavior and micromamba install is all we should ever need?

Let's picture some scenarios -- assuming we have a created environment. What should the ideal command line look like. We could quite easily add the following flags:

jonashaag commented 2 years ago

Yes that sounds reasonable as well. What would be the role of micromamba update in that case? Is it just a shorthand to install --update?

wolfv commented 2 years ago

When using install --update we could use the SOLVER_FLAG_INSTALL_ALSO_UPDATES flag. It would be different from update because update doesn't install any new packages.

https://github.com/mamba-org/mamba/issues/1317

jonashaag commented 1 year ago

We just hit this again. Shall we remove the --file option from `update?

CDTR-MattConroy commented 1 year ago

Is there any intention to add a --prune option to be able to remove packages that are not specified in an environment file?

shenker commented 1 year ago

My understanding is that mamba env update -n myenv -f environment.yml --prune will install new packages, update existing packages, and remove extraneous packages so that myenv ends up in the same state as it would be if you did mamba env remove -n myenv && mamba create -n myenv -f environment.yml.

It would be good for an analogous command to exist in micromamba. It would be especially convenient if this command created the environment if it didn't already exist. (E.g., after you run this command, you're guaranteed to end up with myenv matching the given environment.yml file regardless of the initial state or existence of myenv, and the command would get you there in the most efficient way.)

goyalyashpal commented 1 year ago

--prune-to-specs - @ wolfv at https://github.com/mamba-org/mamba/issues/1455#issuecomment-1032754684

that is very much needed 😃 the issue with env create is that it doesn't use existing cache and has to download all the packages again.

combining this with #2700 issue, this pruning feature will allow to quickly remove the devt dependencies to get a lean environment back again.

GitHunter0 commented 1 year ago

What's the current best alternative to micromamba env update -n X -f environment.yml?

jonashaag commented 1 year ago

Fixed in https://github.com/mamba-org/mamba/pull/2827?

chenzhekl commented 9 months ago

--prune-to-specs

that is very much needed 😃 the issue with env create is that it doesn't use existing cache and has to download all the packages again.

combining this with #2700 issue, this pruning feature will allow to quickly remove the devt dependencies to get a lean environment back again.

micromamba env create -f env.yaml already reuses cache and is pretty fast to update an existing environment now.