From yml file using conda.
Example yml file, create this as my_python_env.yml
name: my_python_env
channels:
- conda-forge
- defaults
dependencies:
- python=3.10
- jupyterlab==3.2.5
- matplotlib==3.3.0
- pandas==1.4.2
- numpy==1.20.2
- seaborn==0.11.2Set up env
conda env create -f covid_pyenv.yml
Activate the environment
conda activate uncertainty_env
Add to Ipython kernels
ipython kernel install --name "covid_pyenv" --user
You can then install packages using pip/conda, to take snapshot of the environment use:
conda env export --no-builds | grep -v "prefix" > my_python_env.yml
More on conda here: https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html#activating-an-environment
- using the renv package
- instructions here: https://rstudio.github.io/renv/articles/renv.html
renv::init()- work install etc
renv::snapshot()renv::restore()- revert to previous state
Example Rmd script using renv: https://github.com/ozika/trait-anxiety-and-state-inference-zika2022/blob/master/scripts/stats_main.Rmd
venv
git clone
cd
pip install virtualenv (if you don't already have virtualenv installed)
virtualenv venv to create your new environment (called 'venv' here)
virtualenv venv --python=/usr/bin/python3.7
source venv/bin/activate to enter the virtual environment
pip3 install --upgrade pip
pip install -r requirements.txt to install the requirements in the current environment