# Micromamba Installation and Usage Guide
> [!Warning]
> It is recommended not to install `micromamba` if you already have `conda` installed on the same system. Using both `conda` and `micromamba/mamba` together can lead to conflicts and inconsistent behavior in managing environments and packages. Choose one tool to manage your environments to maintain system stability and consistency.
## 1. Installing Micromamba
Micromamba is a minimal, fast alternative to Conda that is ideal for CI/CD pipelines and minimal setup scenarios. It does not come with a base environment, which means all environments and caches are managed under the `MAMBA_ROOT_PREFIX` environment variable.
### Homebrew on macOS
```bash
brew install micromamba
```
### Automatic Installation
This method works on macOS, Linux, or Git Bash on Windows:
```bash
"${SHELL}" <(curl -L micro.mamba.pm/install.sh)
```
For Windows PowerShell, use:
```bash
Invoke-Expression ((Invoke-WebRequest -Uri https://micro.mamba.pm/install.ps1).Content)
```
### Updating Micromamba
To update micromamba to the latest version:
```bash
micromamba self-update
```
## 2. Creating and Managing Environments
Use a YAML file to define environments. This approach ensures consistency across different systems and simplifies package management.
### Creating the YAML File
Name the file `gdal_environment.yml` and populate it with the following:
```yaml
name: gdal_master_env
channels:
- gdal-master
- conda-forge
- defaults
dependencies:
- python=3.12
- gdal-master::gdal
- gdal-master::libgdal-arrow-parquet
- h5py
- pip
```
### Creating the Environment
```bash
micromamba create -f gdal_environment.yml
```
### Activating the Environment
```bash
micromamba activate gdal_master_env
```
### Check GDAL Version
1. CLI
```bash
gdalinfo --version
```
RESULT: `GDAL 3.9.0dev-164afac0db-dirty, released 2024/04/16`
2. GDAL Python Version
```bash
python
>>> from osgeo import gdal
>>> print(gdal.__version__)
```
RESULT : `3.9.0dev-164afac0db-dirty`
### Updating the Environment
To update the environment based on the YAML file:
```bash
micromamba update -n gdal_master_env -f gdal_environment.yml
```
### Deactivating the Environment
```bash
micromamba deactivate
```
### Removing the Environment
```bash
micromamba remove -n gdal_master_env --all
```
## 3. Uninstalling Micromamba
To uninstall micromamba, simply delete the micromamba binary and any environments you've created. Detailed steps depend on your installation method.
## General Notes
* Commands for Conda/Mamba can be used with Micromamba with slight syntax changes. Micromamba is typically faster and more suited for automated setups.
* If you have both Conda and Micromamba installed, make sure to manage environments with one tool at a time to avoid conflicts.
* For windows users u may have `PSSecurityException` to solve this issue you can
`Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy Unrestricted -Force;`