MMSciCode env reconstruction on the domestic server
This bundle reconstructs the 204 MMSciCode conda envs on a domestic Chinese server using mirror sources (no need to download the 165 GB tarball repo). It then packs each env into a tarball and builds a Docker image per env.
Inputs (from HF: MMSciCode/mmsci-envs-tmp)
configs/
<env>/
env.yml # conda env create -f
explicit.txt # conda list --explicit --md5 (URL-pinned fallback)
pip-freeze.txt # raw pip freeze from local env
pip-clean.txt # pip-freeze with conda-built file:// stripped
editable.txt # tab-separated: <egg-link name> \t <original source path>
meta.json # python ver, has_cuda hint, editable_count
editable_bundle.tar.gz # only present if any env had editable installs
Domestic-server prerequisites
- conda (or miniconda) installed; conda >= 22.x
mambafrom the base env:conda install -n base -c conda-forge mamba conda-pack- Docker (with
nvidia-dockerruntime if envs need GPU) - ~200 GB free disk for staging tarballs + ~300 GB for Docker images
Step 1 β configure mirrors
cp configs_repo/remote/condarc.template ~/.condarc
mkdir -p ~/.config/pip
cp configs_repo/remote/pip.conf.template ~/.config/pip/pip.conf
Step 2 β fetch the artifacts
# example using huggingface_hub with HF_ENDPOINT=https://hf-mirror.com if needed
huggingface-cli download MMSciCode/mmsci-envs-tmp \
--repo-type dataset \
--local-dir /home/mmsci/repo \
--include 'configs/**' 'editable_bundle.tar.gz'
cd /home/mmsci/repo
[ -f editable_bundle.tar.gz ] && tar -xzf editable_bundle.tar.gz # -> editable_sources/
Step 3 β build all envs (parallel) and pack each as a tarball
CONFIGS_DIR=/home/mmsci/repo/configs \
OUT_DIR=/home/mmsci/conda_packs \
EDITABLE_SRC=/home/mmsci/repo/editable_sources \
MAMBA_BIN=/opt/conda/bin/mamba \
CONDA_PACK=/opt/conda/bin/conda-pack \
JOBS=4 \
bash /home/mmsci/configs_repo/remote/build_envs_remote.sh
Outputs:
$OUT_DIR/<env>.tar.gzβ per-env conda-pack tarball$OUT_DIR/build.state.tsvβ per-env status (done/skip/fail)$OUT_DIR/build.failed.txtβ failed envs (re-run script to retry; idempotent)$OUT_DIR/_logs/<env>.logβ per-env mamba + pack log
Expect 5β15% of envs to fail on first pass (mirror gaps, conda-pack errors, editable misses). Inspect the failed logs and either:
- Adjust env.yml (drop the offending pin, add a missing channel), or
- Fall back to the original tarball from
MMSciCode/mmsci-envs-tmproot:huggingface-cli download MMSciCode/mmsci-envs-tmp --include '<env>.tar.gz' --local-dir $OUT_DIR
Step 4 β build Docker images
Get the Dockerfile (from the source repo or the HF docker_build/ upload):
PACKS_DIR=/home/mmsci/conda_packs \
DOCKERFILE=/home/mmsci/configs_repo/Dockerfile.conda-env \
IMAGE_PREFIX=mmsci-py \
JOBS=2 \
bash /home/mmsci/configs_repo/remote/build_docker_images.sh
Each env -> mmsci-py-<sanitized-name>:latest. The Dockerfile is the
unmodified Dockerfile.conda-env β it only does COPY tarball; tar -xzf; conda-unpack, so build time per image is whatever your disk can write
the tarball at (~30sβ2min per image).
Troubleshooting
PackageNotFoundError during mamba env create
The Tsinghua/Aliyun mirrors don't have every conda-forge package. Try:
mamba env create -n <env> -f configs/<env>/env.yml \
--override-channels -c conda-forge -c defaults
If still missing, the explicit URL list often works:
conda create -n <env> --file configs/<env>/explicit.txt
(URLs point to anaconda.org which is reachable but slow; consider setting
CONDA_SUBDIR=linux-64.)
pip install connection errors
Confirm ~/.config/pip/pip.conf is in effect: pip config list. Some
git+https URLs in pip-freeze.txt may need a proxy; consider running the
build under https_proxy=... if you have a corporate proxy.
conda-pack editable-packages error
build_envs_remote.sh passes --ignore-editable-packages so this should not
happen. If it does, the env has an editable install that wasn't recorded in
editable.txt β re-export from the source machine.