Christopher Juckins

SysAdmin Tips, Tricks and other Software Tools

User Tools

Site Tools


python_virtual_environments

Python Virtual Environments

Overview to Conda environments

Installing miniconda

  • Download and install miniconda3 as non-admin user from https://docs.conda.io/en/latest/miniconda.html
  • Get the "Miniconda3 Linux 64-bit" version
  • NOTE: You may need to remove a $HOME/.condarc file if you have one to prevent repo source conflicts
cd $HOME
mkdir $HOME/tmpconda
TMPDIR=$HOME/tmpconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
TMPDIR=$HOME/tmpconda bash Miniconda3-latest-Linux-x86_64.sh
  • (Accept license agreement and all the suggested default choices)
~/miniconda3/bin/conda create -n testwpc -c conda-forge time numpy requests pygrib netCDF4 scipy
~/miniconda3/bin/conda init bash
  • (Open a new xterm and type 'bash')
conda activate $HOME/miniconda3/envs/testwpc
cd $HOME/miniconda3/envs/testwpc
  • (do work)
conda deactivate

Setting up a python virtual environment

python3 -m venv venv_test
source venv_test/bin/activate
cd venv_test
pip list
pip install --upgrade pip
pip install pygrib

(venv_test) (base) [[email protected]: ~/venv_test]$ pip list
Package    Version
---------- ---------
certifi    2022.6.15
numpy      1.21.6
pip        22.1.2
pygrib     2.1.4
pyproj     3.2.1
setuptools 40.6.2

When done working:

deactivate
python_virtual_environments.txt · Last modified: 2022/08/26 11:54 by juckins