Skip to content

Commands to Set Up a Conda Virtual Environment

Andrew Escay edited this page Jun 18, 2018 · 1 revision

Source: https://uoa-eresearch.github.io/eresearch-cookbook/recipe/2014/11/20/conda/

Step 1: Check if Conda exists

conda -V


Step 2: Update Conda

conda update conda
make sure that you type y and hit ENTER to update relevant packages


Step 3: Creating the Virtual Environment

conda create -n [yourenviname] python=[x.x] anaconda
make sure to type y and hit ENTER


Step 4: Activating Your Environment

source activate [yourenviname]


Step 5: Install Packages to a Virtual Environment

Method A conda install -n [yourenviname] [package]

Method B This may not always work, so try:
conda config --add channels conda-forge
conda install [package]

Method C Lastly, if the first two did not work:
conda install pip

anaconda/envs/[yourenviname]/bin/pip install [package]
or
anaconda3/envs/[yourenviname]/bin/pip install [package]


Step 6: Deactivating Your Virtual Environment

source deactivate


Step 7: Delete Virtual Environment

conda remove -n [yourenviname] -all