Portable Mamba
A portable Miniforge installation script that creates isolated Python environments without modifying system settings.
Features
- Portable: No system installation or registry changes
- Multiple Environments: One installation can manage multiple environments
- Requirements Support: Automatic package installation from requirements.txt
- Flexible Python Versions: Specify any Python version
- Clean: Minimal console output
Usage
Basic Usage
# Create default environment (Python 3.9)
.\portable.ps1
Advanced Usage
# Create specific environment
.\portable.ps1 -EnvName myproject -PythonVersion 3.11
# With requirements file
.\portable.ps1 -EnvName webapp -PythonVersion 3.10 -RequirementsFile requirements.txt
# Force recreate existing environment
.\portable.ps1 -EnvName dataanalysis -Force
# Create environment with custom requirements
.\portable.ps1 -EnvName mlproject -PythonVersion 3.8 -RequirementsFile ml-requirements.txt
Parameters
| Parameter | Type | Default | Description |
|---|---|---|---|
-EnvName |
string | "default" | Name of the environment |
-PythonVersion |
string | "3.9" | Python version to install |
-RequirementsFile |
string | "" | Path to requirements.txt file |
-Force |
switch | false | Force recreation of existing environment |
Examples
Data Science Environment
.\portable.ps1 -EnvName datascience -PythonVersion 3.11 -RequirementsFile data-science.txt
Web Development Environment
.\portable.ps1 -EnvName webdev -PythonVersion 3.10 -RequirementsFile web-requirements.txt
Machine Learning Environment
.\portable.ps1 -EnvName ml -PythonVersion 3.9 -RequirementsFile ml-requirements.txt
File Structure
After running the script, you'll have:
Miniforge-Portable/
├── miniforge.exe
├── portable.ps1
├── mamba/ # Miniforge installation
│ ├── conda.exe
│ ├── Scripts/
│ └── envs/ # Environments directory
│ ├── default/
│ ├── myproject/
│ └── webapp/
└── requirements.txt # Your requirements file
Requirements File Format
Create a requirements.txt file with your Python packages:
numpy==1.24.3
pandas==2.0.3
matplotlib==3.7.1
requests==2.31.0
Notes
- The script creates environments in
mamba/envs/directory - Each environment is completely isolated
- No system Python or conda installation required
- Works on any Windows system with PowerShell
- Environments persist between script runs
Description
Languages
PowerShell
58.8%
Python
41.2%