Getting Started with Anaconda on MacOS

Nick Salvatore
Notes in Machine Learning
3 min readJan 28, 2023

Download and install Anaconda

To begin, download the latest Anaconda distribution from https://www.anaconda.com/products/distribution and install the package.

Note: When I first went to download Anaconda, I noticed that the specified Python version next to the download was for Python 3.9. I’m currently using Python 3.8 on my MacBook, so I was concerned about compatibility. However, Anaconda is itself a Python distribution, so compatibility with your local Python installation need not be of concern. This is probably obvious to some, but as a newbie, I was confused.

Terminal basics

Note: If you already had a terminal session open prior to installing Anaconda, make sure to start a new session before attempting any of the following steps.

Activating a conda environment

When I launched my terminal, the Conda base environment was already activated, indicated by the following:

(base) ~

If the Conda environment isn’t activated, you can use conda activate to get it activated.

~ conda activate
(base) ~

To deactivate, you use conda deactivate .

(base) ~ conda deactivate
~ conda activate
(base) ~

To create a new environment, you can type conda create --name <environment_name> :

(base) ~ conda create --name my_django_app

You can also specify a Python version for your new environment. For instance, to install Python 3.7 in your new environment, use the following:

(base) ~ conda create --name my_django_app python=3.7

To activate an environment, use conda activate <environment_name> as is used in the following example:

(base) ~ conda activate my_django_app
(my_django_app) ~ python --version
Python 3.7.16

To view all of your Conda environments, use conda env list , as can be seen below:

(my_django_app) ~ conda env list
# conda environments:
#
base /Users/username/opt/anaconda3
my_django_app * /Users/username/opt/anaconda3/envs/my_django_app
my_flask_app /Users/username/opt/anaconda3/envs/my_flask_app

If you are already familiar with virtual environments, Conda environments are pretty much the same thing. The base Conda environment comes with a large collection of installed packages typically used for data science and machine learning purposes. To view all of the packages installed in your current environment, you can use conda list .

(base) ~ conda list
# packages in environment at /Users/username/opt/anaconda3:
#
# Name Version Build Channel
_ipyw_jlab_nb_ext_conf 0.1.0 py39hecd8cb5_1
alabaster 0.7.12 pyhd3eb1b0_0
anaconda 2022.10 py39_0
anaconda-client 1.11.0 py39hecd8cb5_0
anaconda-navigator 2.3.2 py39hecd8cb5_0
anaconda-project 0.11.1 py39hecd8cb5_0
anyio 3.5.0 py39hecd8cb5_0
appdirs 1.4.4 pyhd3eb1b0_0
applaunchservices 0.3.0 py39hecd8cb5_0
appnope 0.1.2 py39hecd8cb5_1001
appscript 1.1.2 py39h9ed2024_0
...

Note: As mentioned in the installation section, Anaconda is itself a Python distribution, so the version of Python installed in your base environment will likely be different from the one installed globally on your local machine. To test this out, you can type python --version in your base environment. For myself, this returns Python 3.9.13 If I deactivate the base environment and type python --version , it will return Python 3.8.9 .

To view packages installed in a Conda environment that is not currently activated, you can use conda list --name <environment_name> . For example, here’s how you would view the packages installed in an environment called my_flask_app while still in the base environment:

(base) ~ conda list --name my_flask_app
# packages in environment at /Users/username/opt/anaconda3/envs/my_flask_app:
#
# Name Version Build Channel
bzip2 1.0.8 h1de35cc_0
ca-certificates 2023.01.10 hecd8cb5_0
certifi 2022.12.7 py310hecd8cb5_0
click 8.0.4 py310hecd8cb5_0
flask 2.2.2 py310hecd8cb5_0
greenlet 2.0.1 py310hcec6c5f_0
itsdangerous 2.0.1 pyhd3eb1b0_0
jinja2 3.1.2 py310hecd8cb5_0
libcxx 14.0.6 h9765a3e_0
libffi 3.4.2 hecd8cb5_6
markupsafe 2.1.1 py310hca72f7f_0
ncurses 6.4 hcec6c5f_0
...

Installing Packages

Similar to installing packages in a virtual environment by using pip , you can use conda install <package_name> to install packages in your Conda environments.

Here’s an example for my_django_app :

(my_django_app) ~ conda install django

Conda will find all of the necessary dependencies to be installed and then prompt you to confirm the install.

Again, conda list will show you the packages installed in the currently activated environment.

(my_django_app) ~ conda list
# packages in environment at /Users/username/opt/anaconda3/envs/my_django_app:
#
# Name Version Build Channel
asgiref 3.5.2 py37hecd8cb5_0
ca-certificates 2023.01.10 hecd8cb5_0
certifi 2022.12.7 py37hecd8cb5_0
django 3.2.15 py37hecd8cb5_0
flit-core 3.6.0 pyhd3eb1b0_0
krb5 1.19.4 hdba6334_0
libedit 3.1.20221030 h6c40b1e_0
libffi 3.4.2 hecd8cb5_6
libpq 12.9 h1c9f633_3
ncurses 6.4 hcec6c5f_0
openssl 1.1.1s hca72f7f_0
pip 22.3.1 py37hecd8cb5_0
psycopg2 2.9.3 py37h0a4fc7d_0
python 3.7.16 h218abb5_0
...

--

--