5

I want to migrate all my existing environments to micromamba on my Mac (i.e., move my envs to /Users/UserName/micromamba/envs/) to use micromamba exclusively. What's the best way to move my existing environments?

I'm not sure where to begin with this - not sure if simply copying/pasting my existing environments would work and don't want to break them accidentally.

  • What is the motivation for this? I’ve never encountered a need for this. Micromamba can work on an existing Conda installation. – merv Jan 09 '23 at 04:50
  • 1
    My primary motivation is having all my current and future environments in one place. I guess I could accomplish that by creating future environments in the same directory that the current environments are located, but seems cleaner to have them in the micromamba/envs directory. I'd like to experiment with only using micromamba. If that goes well, and I anticipate that'll work for me from reading the docs and playing around with it a bit, I'd likely uninstall conda and mamba. – Tyce Herrman Jan 09 '23 at 17:01
  • 1
    Why not try using only Micromamba for several weeks, but keep your current prefixes? I.e., set `export MAMBA_ROOT_PREFIX=$(conda config --show root_prefix | cut -d' ' -f2)`. Also, `envs_dirs` and `pkgs_dirs` support *multiple* locations. But otherwise, one cannot simply "copy" environments. Either you recreate them via YAML, clone them into the new prefix, or do some hacky stuff with [the Conda Prefix Replacement (`cpr`) tool](https://github.com/conda/conda-prefix-replacement#conda-prefix-replacement). – merv Jan 09 '23 at 17:38
  • 2
    I have the same issue, and the motivation is that mamba uses conda in the backend, and I'm hitting conda bugs related to GPU (even mamba/conda info takes about 10 seconds). So I'd rather move to micromamba – adrin Feb 23 '23 at 13:01
  • @TyceHerrman Have you succeeded? I am also considering the same thing. – Hojin Cho Apr 04 '23 at 05:12

1 Answers1

0

Since during the installation of conda environments, all paths inside of the environment are hardcoded to the specific environment path, you can't just move the directory and call it a day. In my opinion, the following two options would be the most feasible:

  1. Call micromamba activate /path/to/conda-env and then micromamba env export > myenv.yml. This will create a new environment file with all conda dependencies that you have pinned to the build number. You can then call micromamba create -n env-name -f myenv.yml to create it a second time in the micromamba installation. This won't save any other stuff that you did inside of your environment, for example additional pip installations, etc.

  2. Another option could be to use conda-pack. I haven't tried this out myself but it looks like it should fit your use case.

pavelzw
  • 66
  • 3