Continuum seem intent on shooting themselves in the foot with their new license and purchase terms so my employer is moving away from Anaconda with the forge default to Miniforge with. the forge conda-forge.
Now you might think there was a spot where we could change “default” to “conda-forge”, our work would be done and we could celebrate with magic cupcakes. Things aren’t that easy. To make sure it is done right we need to go through all our python projects and export a list of packages in the environment1. To make the code simpler we put all the projects into a folder called “SHIFT” in your home folder. They don’t have to stay there, they can be moved back to wherever they came from once we finish.
Then we remove Anaconda, making sure there are no remnants remaining. The penultimate task is downloading miniforge and installing it. Finally we recreate the environments we had in Anaconda using those files Anaconda wrote.
#!/bin/zsh## Anaconda to miniforge migration## we are assuming that the projects using anaconda are all lined up in the one# directory ~/SHIFT/for i in ~/SHIFT/*; do if [ -d "$i" ]; then cd "$i" || continue HERE=$(basename "$i") # we are assuming the conda env name is the same as the project directory name conda activate "$HERE" conda env export > environment.yml # some authors of deprecate instructions point out `conda env export` # outputs lines like: # some_package=1.2.3=py38h1234567_0 # which conda cannot parse, so we need to strip off the build specifier # why conda cannot parse it's own output is beyond me. sed -i '.bak' 's#\(^.*=.*\)=#\1#' environment.yml cd - || continue fidone# Remove anaconda and all it's fluffconda init --reverse --all # undo conda init changes to shell config filesconda install anaconda-clean anaconda-clean --yes # remove all anaconda-related files# let's be surerm -rf "~/anaconda*/"rm -rf "~/.anaconda*/"rm -rf "~/Library/Receipts/io.continuum*"# Install miniforgecurl -LsS \https://github.com/conda-forge/miniforge/releases/download/25.11.0-1/Miniforge3-25.11.0-1-MacOSX-arm64.sh \> Miniforge3-25.11.0-1-MacOSX-arm64.shchmod +x Miniforge3-25.11.0-1-MacOSX-arm64.sh./Miniforge3-25.11.0-1-MacOSX-arm64.sh -b -p $HOME/miniforge3rm Miniforge3-25.11.0-1-MacOSX-arm64.shfor i in ~/SHIFT/*; do if [ -d "$i" ]; then cd "$i" || continue conda env create -f environment.yml cd fidone
- Just so you have an idea of how bad conda is notice that
exportcan create lines that can’t be parsed in an environment package list. We have a piece of software that cannot parse it’s own output. ↩︎



