Set up Conda Computing Environment¶
Conda makes software installation and compute environment management easier by making sure that all the software you are using for a particular project works together. Conda can be installed via Miniconda (a smaller more efficient package) or Anaconda (the full installation of conda). This tutorial is a walk-through with Miniconda. From the conda website:
"Miniconda is a free minimal installer for conda. It is a small, bootstrap version of Anaconda that includes only conda, Python, the packages they depend on, and a small number of other useful packages, including pip, zlib and a few others. Use the conda install command to install 720+ additional conda packages from the Anaconda repository."
- Install Miniconda
- Set up a conda environment
20 mins to install and set up
This tutorial is written specifically for installing the MacOS version of Miniconda.
Please refer to the conda command cheat sheet for commonly used conda commands!
Step 1: Download the installer¶
Select the installer for: "Miniconda3 MacOSX 64-bit bash". We are using the 64-bit version for working with Python 3.x.
Step 2: Verify your installer hashes¶
Go to the directory where you saved the installer file (e.g., "Downloads/"). Open up Terminal and navigate to that directory:
shasum -a 256 Miniconda3-latest-MacOSX-x86_64.sh
Step 3: Install Miniconda¶
you will be asked to review the license. Hit Enter key and scroll through.
you will be asked if you accept the license terms. Type
Miniconda will be installed in the location printed on the screen. Hit Enter key to confirm.
Miniconda will now be installed. This takes a few minutes to complete. The progress will be displayed in the Terminal window.
you will be asked if you wish the installer to initialize Miniconda3 by running conda init. Type
for changes to take effect,
exitand re-open Terminal window.
Step 4: Verify that you can run conda¶
Now, when you re-open Terminal, the command prompt will start with
(base), indicating that you are in the base conda environment. It will look something like this:
Check the version of your new conda installation:
If you got a conda version, then you are ready for the next step!
Step 5: Configure conda¶
Conda uses channels to look for available software installations. These are some good channels to set up:
conda config --add channels bioconda
conda config --add channels conda-forge
Step 6: Set up conda environment¶
There is always a
(base) conda environment. You can then create new environments with different software set ups with the basic command:
conda create -n <name of env>
This takes a few minutes (you'll see the message "Solving environment"). Conda will then ask you to confirm the location of the new environment. Type
More options to customize the environment are documented under the help page for this command:
conda create -h.
If you want to create an environment from a text file called "environment.yml" that specifies the environment's requirements, the command would look like this:
conda env create -n <new conda env name> -f environment.yml. The
-f flag specifies the ".yml" file that contains software requirements.
Step 7: Activate conda environment¶
conda activate <conda env name>
Now, your command prompt starts with
(<conda env name>). If you named your new environment "potato" it would look like this:
Step 8: Take a look around your new conda environment!¶
This command shows you information about the conda environment you activated:
Step 9: Install packages¶
The basic command for installing packages is:
conda install -y <software name>
It will ask if you want to install dependencies. Type
y. This command will show a list of the software installed in this environment:
conda list -n <conda env name>
Step 10: Leave conda environment¶
You'll now be back in the
Now you should have a working conda installation that you can use to create custom conda environments!