This repo captures and reproduces your Conda+pip environment cleanly.
conda env create -f environment.yml
# If the env already exists:
conda env update -f environment.yml --prune
# Activate (uses the name defined inside environment.yml):
# conda activate <name_from_yaml># Create and activate
conda create -n myenv --file conda_requirements.txt -y
conda activate myenv
# Then install pip packages
pip install -r pip_requirements.txtAfter you add or change packages, regenerate the files with:
./scripts/export_env.sh <your_env_name>This updates:
environment.yml(portable full spec)conda_requirements.txt(conda-only spec)pip_requirements.txt(pip-only spec excluding pip/setuptools/wheel)LAST_EXPORTED_UTC.txt(timestamp marker)
Commit and push these changes to keep the repo current.
From a fresh clone of this repo:
# Preferred
./scripts/recreate_env.sh <target_env_name>
# Or do it manually:
conda env create -f environment.yml # then conda activate <name_from_yaml>
# OR:
conda create -n <target_env_name> --file conda_requirements.txt -y
conda activate <target_env_name>
pip install -r pip_requirements.txtTip: If
environment.ymldefines a different name than the one you want to use, either:
- Use
./scripts/recreate_env.sh <target_env_name>(it will try to activate the name in the YAML if present), or- Edit the
name:inenvironment.ymlbefore running the command.
- List only the pip packages you installed (excludes bootstrap tools):
pip list --format=freeze | grep -vE '^(pip|setuptools|wheel)=='- Save pip-only packages for migration:
pip list --format=freeze | grep -vE '^(pip|setuptools|wheel)==' > pip_requirements.txt- Export everything into a single YAML:
conda env export --no-builds > environment.yml- Use Anaconda Prompt or PowerShell where
condais initialized. - On Windows, the Bash scripts will run under Git Bash or WSL. Alternatively, copy the commands inside the scripts and run them manually in Anaconda Prompt.
- Prefer
conda installwhen packages exist on conda channels for easier resolution. - Use
pip installfor packages not available on conda. - After changes, re-run
./scripts/export_env.sh <env>and commit updates.