Choosing a tool
| Tool | Primary purpose | Key benefits | Sample command |
|---|---|---|---|
| Conda (recommended) | Scientific work with substantial dependencies | Precompiled binaries, cross-language, environment export | conda create -n myenv python=3.10 |
| venv | Smaller projects, personal utilities | Uses system Python, built into Python 3 | python3 -m venv myenv |
| pip | Adding packages to an existing environment | Straightforward, broadly compatible | pip install requests |
Avoid: Do NOT use
pip install --user to install directly into your home directory โ use conda or venv to keep proper isolation.Conda workflow
module load anaconda/3 conda create -n analysis python=3.10 conda activate analysis conda install numpy scipy matplotlib
venv workflow
python3 -m venv myenv source myenv/bin/activate pip install numpy scipy matplotlib
Recommendations
- Load anaconda before any environment operations
- Keep environments within
$HOMEor project directories - Export dependencies:
conda env export > environment.yml - Minimize mixing pip and conda in the same environment
Applies to