You should have completed a [Minimamba installation](Minimamba%20installation.md).
# Environment handling
## Import environment
```shell
conda env create -f environment.yml
```
## Create environment
```shell
mamba create --name myenv python=3.10
```
## Activate environment
```shell
mamba activate myenv
```
## Export environment
```shell
conda env export --from-history > environment.yml
```
To export a pinned environment, use:
```shell
conda env export > environment.pinned.yml
```
## Update environment (from config)
```shell
conda env update --file environment.yml --prune
```
# Inspect current environment
```shell
mamba info
```
Right in the first lines, it tells you the active environment (if any):
```
active environment : gpt
active env location : /Users/fnl/work/miniconda3/envs/gpt
```
# Automate environment with direnv
Create a `.envrc` file and put the following line in it:
```shell
source ~/dev/lib/miniconda3/etc/profile.d/mamba.sh
source ~/work/miniconda3/etc/profile.d/mamba.sh
source ~/Workspace/lib/miniconda3/etc/profile.d/mamba.sh
source # or some other path...
```
After which, you should be able to auto-activate using the right conda env name:
```
mamba activate my-env
```
To set up a conda env, you must first source `mamba.sh` from your directory, hence the first line.
Now you can proceed to [using mamba](mamba%20usage.md).