Wed. Nov 19th, 2025

About

We sometimes need to install packages thru some sources such as conda-forge and PyPi. Therefore, we need to handle both environments, Conda (Mini-Conda) and the other virtual python on same environment. This is kind of headache because of confliction. But I found that there is a way to install mini conda on the pyenv environment. It means that we can use virtual-env and conda on the same environment.

Install Mini-Conda

pyenv install miniconda3-4.7.12
pyenv global miniconda3-4.7.12
#conda init bash
#source ~/.bashrc
pyenv activate miniconda3-4.7.12

#conda create -n base-env python=3.10 -y
#conda activate base-env

#?
micromamba activate base-env

Install Mamba

#? not needed??
conda install -n base-env -c conda-forge mamba -y
conda install -c conda-forge mamba -y

Clone and Activate

#conda create --name petsc-env --clone base-env
#conda activate petsc-env
micromamba create -n petsc-env -c conda-forge python=3.12
micromamba activate petsc-env

Install Package

micromamba install -c conda-forge petsc4py