How to Install, Create, and Use Conda Virtual Environments on any Ubuntu Machine?


Hello Dear Programmers,

In this blog, I will be explaining step by step, how you can setup, create, and use Conda Virtual Environments on any Ubuntu machine.


Step 1: Installing Conda

Follow below steps to download and install conda:
  1. Open Terminal 
  2. Run 'sudo apt-get update'
  3. Run 'sudo apt-get install curl'
  4. Open https://www.anaconda.com/products/individual in a browser, scroll to the bottom, and copy link of the highlighted version as shown in the below image: 

  5. In Terminal, run 'curl –O https://repo.anaconda.com/archive/Anaconda3-2021.11-Linux-x86_64.sh'. Replace the link with the copied one from the previous step.
  6. Run 'bash Anaconda3-2021.11-Linux-x86_64.sh'. Replace the file name with file downloaded in the previous step. Press 'Enter' or type 'Yes' if asked in the terminal. This will complete the installation process.
Step 2: Create Conda Virtual Environment
  1. Open new Terminal, and run 'source ~/.bashrc'.
  2. Run 'conda create ––name py37 python=3.7'. You can give your custom environment name instead of py37, and specify which python version to use. This will create a conda virtual environment.
  3. To see list of conda enironments, you can run 'conda env list'.
Step 3: Activate and Deactivate Conda Virtual Environment
  1. To activate, run 'conda activate py37'. Give your environment name instead of py37.
  2. To deactivate, run 'conda deactivate'.

If you liked the content, kindly leave your valuable comments.
Thanks and Happy Coding! :)

Buy Me a Coffee - https://www.buymeacoffee.com/agautam

Comments