Anaconda Notes

Introduction

What is Anaconda Distribution?

Anaconda® Distribution is a free Python/R data science distribution that contains:

Anaconda Distribution is free, easy to install, and offers free community support.

Why do I need Anaconda Distribution?

Many scientific packages require a specific version of Python to run. It’s difficult to keep various Python installations on one computer from interacting and breaking, and harder to keep them up-to-date. Anaconda Distribution makes management of multiple Python versions on one computer easier, and provides a large collection of highly-optimized, commonly-used data science libraries to get you started faster.

What is Miniconda?

Miniconda is Conda and its dependencies. With Miniconda, you can build your environments from scratch by installing only the packages needed to run the Conda command. It’s a much smaller installer, typically used with an active internet connection.

Here's a guide to help you choose between Anaconda and Miniconda, see: Should I use Anaconda Distribution or Miniconda?

Installing and Uninstalling Anaconda on Windows

Installation

  1. Download the Anaconda installer.

  2. Go to your Downloads folder and double-click the installer to launch. To prevent permission errors, do not launch the installer from the Favorites folder.

    Note

    If you encounter issues during installation, temporarily disable your anti-virus software during install, then re-enable it after the installation concludes. If you installed for all users, uninstall Anaconda and re-install it for your user only.

  3. Click Next.

  4. Read the licensing terms and click I Agree.

  5. It is recommended that you install for Just Me, which will install Anaconda Distribution to just the current user account. Only select an install for All Users if you need to install for all users’ accounts on the computer (which requires Windows Administrator privileges).

  6. Click Next.

  7. Select a destination folder to install Anaconda and click Next. Install Anaconda to a directory path that does not contain spaces or unicode characters. For more information on destination folders, see the FAQ.

    Caution

    Do not install as Administrator unless admin privileges are required.

  8. Choose whether to add Anaconda to your PATH environment variable or register Anaconda as your default Python. We don’t recommend adding Anaconda to your PATH environment variable, since this can interfere with other software. Unless you plan on installing and running multiple versions of Anaconda or multiple versions of Python, accept the default and leave this box checked. Instead, use Anaconda software by opening Anaconda Navigator or the Anaconda Prompt from the Start Menu.

    Note

    As of Anaconda Distribution 2022.05, the option to add Anaconda to the PATH environment variable during an All Users installation has been disabled. This was done to address a security exploit. You can still add Anaconda to the PATH environment variable during a Just Me installation.

  9. Click Install. If you want to watch the packages Anaconda is installing, click Show Details.

  10. Click Next.

  11. Optional: To learn more about Anaconda’s cloud notebook service, go to https://www.anaconda.com/code-in-the-cloud.

    Or click Continue to proceed.

  12. After a successful installation you will see the “Thanks for installing Anaconda” dialog box:

  13. If you wish to read more about Anaconda.org and how to get started with Anaconda, check the boxes “Anaconda Distribution Tutorial” and “Learn more about Anaconda”. Click the Finish button.

  14. Verify your installation, Click Start, search for Anaconda Prompt or Anaconda Powershell Prompt, and click to open, after opening Anaconda Prompt, choose any of the following methods to verify:

    • Enter conda list. If Anaconda is installed and working, this will display a list of installed packages and their versions.
    • Enter the command python. This command runs the Python shell, also known as the REPL. If Anaconda is installed and working, the version information it displays when it starts up will include “Anaconda”. To exit the Python shell, enter the command quit().
    • Open Anaconda Navigator with the command anaconda-navigator. If Anaconda is installed properly, Anaconda Navigator will open.

Tip

If you are behind a company proxy, you may need to do some additional setup. See how to set up your proxy.

Uninstallation

  1. Enter conda install anaconda-clean in Anaconda Prompt to install the anaconda-clean module.

  2. Then, enter anaconda-clean to removes configuration files that are left behind when uninstalling Anaconda, or automatically delete all files and directories, directly run anaconda-clean --yes.

  3. Search for “Control Panel” in the Windows search box and select the Control Panel app.

  4. Click Uninstall a program under Programs.

  5. Select the Anaconda/Miniconda installation you want to uninstall.

  6. Click Uninstall.

  7. Complete the uninstall instructions that appear.

Conda Cheat Sheet

Here are some common conda commands:

Usage Command
create environment with Python version conda create --name ENVNAME python=3.8
remove the environment and all packages conda remove --name ENVNAME --all
list the Conda environments conda env list
activate environment (do this before installing packages) conda activate ENVNAME
deactivate the current environment conda deactivate
export your active environment to a new file conda env export > ENVNAME.yml
create the environment from the yml file conda env create -f ENVNAME.yml
install a package from specific channel (e.g. conda-forge) conda install -c CHANNELNAME PKG1 PKG2
update all packages conda update --all
list installed packages conda list
remove package from environment conda uninstall PKGNAME -n ENVNAME

More information refer to Getting started with conda and Conda Cheat Sheet.

References

[1] https://docs.anaconda.com/free/anaconda/getting-started/

[2] https://docs.anaconda.com/free/anaconda/install/windows/

[3] https://github.com/ContinuumIO/anaconda-clean

[4] https://docs.anaconda.com/free/anaconda/install/uninstall/