# Anaconda

Anaconda provides a command-line utility called `conda` for installing and managing different versions of the Python programming language and third-party packages.

> Anaconda is a package manager, an environment manager, a Python/R data science distribution, and a collection of over 1,500+ open source packages. Anaconda is free and easy to install, and it offers free community support. - [Anaconda website](https://docs.anaconda.com/anaconda/)

Resources:

* <https://conda.io/docs/_downloads/conda-cheatsheet.pdf>
* <https://conda.io/docs/user-guide/getting-started.html>
* <https://conda.io/docs/user-guide/tasks/manage-conda.html>
* <https://conda.io/docs/user-guide/tasks/manage-environments.html>
* <https://conda.io/docs/user-guide/tasks/manage-pkgs.html#id2>
* <https://conda.io/docs/user-guide/tasks/view-command-line-help.html>

## Detection

To check to see if Anaconda is already installed:

```bash
conda --version
#> conda 4.5.12

# Mac Terminal:
which conda
#> /anaconda3/bin/conda

# Windows Anaconda Prompt or Git Bash:
where conda
#> C:\Users\YOUR_USERNAME\Anaconda3\Library\bin\conda.bat
#> C:\Users\YOUR_USERNAME\Anaconda3\Scripts\conda.exe
```

### Detection on Mac

On a Mac, you can invoke these commands directly in the Terminal.

![](/files/-LxyAyTbshCuicuTRn81)

### Detection on Windows

However, on Windows, you can alternatively search for the "Anaconda Prompt" application to know whether or not you have it installed.

![](/files/-LxyAyTdeAN1mgjqYp4V)

After the Anaconda Prompt is installed, you can invoke `conda` commands from within it:

![](/files/-LxyAyTfGI-b6rZstrUY)

If Anaconda is installed the way we need it to be, we should also be able to invoke `conda` commands from within the Git Bash console:

![](/files/-LxyAyThuAJrxyb2uglR)

If Git Bash doesn't recognize your `conda` commands, you might have to uninstall Anaconda and when re-installing it, make sure to check the "Add Anaconda to my PATH environment variable" option (see installation instructions below).

## Installation

If not yet installed, [download Anaconda Version 3.7](https://www.anaconda.com/download) for either Mac or Windows.

> NOTE: This might take a while, so prefer to do it over a strong WiFi connection. And feel free to ignore any email capture forms which may pop up afterwards.

![](/files/-LxyAyTjObcbTf-2jxtT)

After the download has finished, run the installer program and accept all the default options, except for this important exception to "Add Anaconda to my PATH environment variable", which will allow other programs like Git Bash to recognize the Anaconda installation:

![](/files/-LxyAyTlnF2-3Lu8ALOC)

The installation will take a few minutes to complete.

> NOTE: After installing Anaconda on a Mac, you will need to restart your terminal for the changes to take effect.

After the installation is complete, try repeating the detection commands again, as described in the section above.

Once you are able to successfully detect your installation of Anaconda, you are ready to proceed!

> NOTE: On Windows, you may need to run the command `conda init bash` when prompted to do so, in order to activate a virtual environment for the first time.

## Usage

### The `conda` Utility

View a list of existing virtual environments:

```bash
conda info --envs
```

Create a new virtual environment, and name it something like "my-first-env":

```bash
conda create -n my-first-env

# FYI: you can specify a Python version for your new environment with...
# conda create -n my-first-env python=3.8

# FYI: you can delete any environment with...
# conda env remove -n my-first-env
```

Enter into, or "activate", the virtual environment:

```bash
conda activate my-first-env

# FYI: to deactivate...
# conda deactivate
```

After activating the environment, you should be able to detect and use its installations of Python and Pip:

```bash
which python #> /anaconda3/envs/my-first-env/bin/python
python --version #> Python 3.6.7 :: Anaconda, Inc.

which pip #> /anaconda3/envs/my-first-env/bin/pip
pip --version #> pip 18.1 from /anaconda3/envs/my-first-env/lib/python3.6/site-packages/pip (python 3.6)
```

For more information, see notes on [the `python` utility](/intro-to-python/notes/clis/python.md) and [the `pip` utility](/intro-to-python/notes/clis/pip.md).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://prof-rossetti.gitbook.io/intro-to-python/notes/clis/conda.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
