BYU logo Computer Science

Creating a Conda Environment

A conda environment includes the Python code that includes everything a program needs to run properly. Think of it like this — a proper study environment for you might include a desk, headphones, and lo-fi music. If you don’t have these things, you might not perform well. For a Python program to run effectively, it also needs an environment that includes all the necssary things for it to run.

Conda is a package manager, which is similar to an app store. Conda will create an environment for you, which means installing code and manage updates for that code. It gets all of this software for free (legally!) from the Internet.

Choose a Terminal

Windows terminal

Use the search bar to open a terminal. It needs to have both “Anaconda” and “Powershell” in its name.

Mac terminal

Quit the Terminal app, if it is already open.

Use Launchpad or Spotlight search to open the Terminal app.

All terminals: create conda envirionment

Copy and paste the following two commands:

conda create -n cs110 matplotlib pytest

This first command creates an environment called cs110 and includes the well-known matplotlib and pytest packages.

conda run -n cs110 python -m pip install -U byu_pytest_utils byubit==0.6.17

This second command runs an installer called pip inside the cs110 environment. Pip is useful for creating your own packages and installing less well-known packages, like byu-pytest-utils and byubit.