Anaconda Setup
Anaconda Setup
What is Conda?
Conda is an open source package management system and environment man-
agement system that runs on Windows, macOS, and Linux. Conda quickly
installs, runs and updates packages and their dependencies. Conda easily
creates, saves, loads and switches between environments on your local com-
puter. It was created for Python programs, but it can package and distribute
software for any language.
Conda as a package manager helps you find and install packages. If you need a
package that requires a different version of Python, you do not need to switch
to a different environment manager, because conda is also an environment
manager. With just a few commands, you can set up a totally separate
environment to run that different version of Python, while continuing to run
your usual version of Python in your normal environment.
1 Installation
The fastest way to obtain conda is to install Miniconda, a mini version of
Anaconda that includes only conda and its dependencies. If you would want
to leverage your exotic CPU architecture (aarch64 including Apple Silicon,
ppc64le) the best way would be to install Miniforge! If you prefer to have
conda plus over 7,500 open-source packages, install Anaconda.
Here are some of the system requirements necessary for installation:
1
2
Note: Although there are multiple ways of completing the homework assign-
ments, the libraries we provide you within the YAML file should be the only
ones you reference in the completion of the coding assignments. For the
remainder of this setup we will be using your-env-name to specify
the name of your environment (i.e. XCS229, XCS221, etc) . You
can find the name of your virtual environment by looking for the
name parameter within the environment.yml file.
To create your environment from the YAML file please run:
conda env create -- file environment . yml
Now to specify that the environment was installed correctly, please run the
code below and you should see an environment name that matches with the
name parameter in the environment.yml file:
conda env list
Next, you will activate the created environment. To do so, you will need to
to call the following command:
4
Now in this environment, you will have all the relevant dependencies needed
to complete the assignments. If you want to deactivate your environment
please run:
conda deactivate
And last but not least, ensure to run the following command to launch your
Jupyter Notebook in the active environment
jupyter notebook
That command will take you to your Jupyter Notebook directory. When you
hover over the New button in the top right hand corner, you should see you
environment present as an option.
5
Go ahead and select it and it will create an empty Python Jupyter file where
you can copy and paste assignment code or use it to formulate your thoughts.
In the event you would like to remove your environment from Jupyter, simply
run the following code:
jupyter kernelspec uninstall < your - env - name >
You are now equipped with all the tools to complete the coding assignments.
For a list of the most useful Conda functions, please refer to this document.