1.1. Conda#
Note on copyright
This page is based on information from this page of the TeachBooks manual of the Faculty of Civil Engineering and Geosciences at TU Delft.
Before you can start using python in your book, you need conda: ‘Anaconda’s conda tool simplifies package and environment management across operating systems’ (Anaconda.com), such as windows or MacOS. Using conda you can create new environments for specific projects to make sure the proper packages can function properly!
1.1.1. Installing conda#
There are two common installations of conda: Anaconda and Miniconda. Anaconda is a more complete package with a GUI, whereas Miniconda is more stripped down and therefore less bloated. If you feel comfortable with installing packages yourself, or you have limited disk space, Miniconda is the logical option. You can download the installation files for both here.
When installing either distribution of conda, keep in mind the following:
In general you should use the default file location (do not put it on a separate disk drive, or in a disk partition that is different than your primary OS); however, an exception to this is if you have a space in your Windows username (e.g.,
C:/Users/First Last/Program Files
). In this case, install directly in a folder onC:/
install it only for your User on the computer (this is especially important on Windows; do not install for all users)
1.1.2. Checking the installation#
Once installed, we will check to make sure you are ready to use Python. Conda provides environments, like small virtual mini-computers inside your real computer, and inside each of those environments you have Python (as well as a lot of Python packages)!
Open a command line interface on your computer:
Windows users: this will be the
anaconda prompt
orconda prompt
(search for it in the Start menu at the bottom left of your screen)Mac users: use the terminal application
Once the command line interface is open, type and execute (hit enter) the following:
python --version
Which environment are you in? The name is between parenthesis at the bottom of your Anaconda Prompt: by default, this should be
(base)
.How many other environments do you have? Execute
conda env list
to see a complete list.Do you see the
*
in the list of environments? That is indicating your current active environment. Unless you have changed something, it should bebase
. And if you just installed Anaconda for the first time, this will be your only environment!
If all of these steps succeed, you have everything you need from conda (for now).