Skip to content

Instantly share code, notes, and snippets.

@mfansler
Created February 15, 2021 17:09
Show Gist options
  • Save mfansler/492f2d35623002452bb9bc8cb1db11bd to your computer and use it in GitHub Desktop.
Save mfansler/492f2d35623002452bb9bc8cb1db11bd to your computer and use it in GitHub Desktop.
Download Conda package tarballs needed to create an environment
#!/bin/bash -l
# use tmp dir to avoid name conflicts
tmp=$(mktemp -d)
# solve environment, ignoring existing cache
CONDA_PKGS_DIRS=$tmp conda create -dp $tmp/0 --json "$@" |\
# filter to tarball URLs
grep '"url"' | grep -oE 'https[^"]+' |\
# download locally
xargs wget -c
# clean up
rm -r $tmp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment