The instructions for creating conda environments on Compute Engine virtual machines are exactly the same as those for Vertex AI notebooks. The reason is that notebooks have conda pre-installed and so don't play well with changing the conda environment within the notebook. Thus, if you are using a notebook, follow all steps from within a terminal, which you can access from the launcher.
curl -L -O https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh
bash Mambaforge-$(uname)-$(uname -m).sh -b -p $HOME/mambaforge
export PATH="$HOME/mambaforge/bin:$PATH"
From within the notebook you can add Mamba to path with
import os
os.environ["PATH"] += os.pathsep + os.environ["HOME"]+"/Mambaforge/bin"
mamba create -n vcftools -c bioconda vcftools ipykernel -y
You can also create the environment using a yaml file like this: mamba env create -f environment.yml
source activate vcftools
python -m ipykernel install --user --name=vcftools
If you get a no module named ipykernel
, then run pip3 install ipykernel
.
Now you can switch to the kernel either from the launcher
Or, from the top right from within the notebook.