I'd like to see the date I made a mamba environment on my linux machine. I can't find anything in the docs for this. I tried the following command, but it didn't give me the info I wanted:
mamba env export --from-history -n moose_peacock
Any suggestions (other than detective work with package version release dates)?
Conda environments1 keep metadata in the ${CONDA_PREFIX}/conda-meta
folder and specifically the first line of the ${CONDA_PREFIX}/conda-meta/history
file records the date of the first transaction (creation).
Let's create an environment and then check the first few lines of the history
file:
Interactive (Activating) Environment
$ mamba create -n foo
$ mamba activate foo
(foo) $ head -n3 ${CONDA_PREFIX}/conda-meta/history
==> 2023-11-06 23:59:57 <==
# cmd: /Users/user/miniconda3/bin/mamba create -n foo
# conda version: 23.7.4
Single-Line Command with Conda Run
$ mamba run -n foo bash -c "head -n3 \${CONDA_PREFIX}/conda-meta/history"
==> 2023-11-06 23:59:57 <==
# cmd: /Users/user/miniconda3/bin/mamba create -n foo
# conda version: 23.7.4
The following bash script will list this information for all non-base environments:
show-env-creation-all.sh
#!/bin/bash -l
_CONDA_PREFIX=$(conda run -n base bash -c "echo \${CONDA_PREFIX}")
for env in ${_CONDA_PREFIX}/envs/*; do
if [ -d "$env" ]; then
echo "Environment: $(basename $env)"
head -n3 "$env/conda-meta/history"
echo " "
fi
done
which can be run with:
bash -l show-env-creation-all.sh
[1]: The term "Mamba environment" is a misnomer. Mamba is an interface for Conda environments - it's all still Conda.