Installing Python on your computer#

https://www.python.org/static/community_logos/python-logo.png This chapter contains some instructions about how to install Python on your personal computer.

There are many ways to install Python on your computer (and while most of them work, some of them are less practical than others for scientific applications). Unless you know what you are doing (i.e.: you have been doing this before), please follow these instructions exactly.

Install Miniconda#

On Windows#

Go to the miniforge download website: conda-forge/miniforge

Download the installers for Mambaforge and your operating system (Windows, Mac OS or Linux). Unless you have an uncommon architecture (unlikely), you should choose the x86_64 files.

../_images/download_options.png

Double-click the .exe file.

Follow the instructions on the screen.

If you are unsure about any setting, accept the defaults. You can change them later. At this stage, I recommend:

../_images/install_options.png

On Mac OS and Linux#

For these platforms, no need to download the files yourself. Open a terminal and do:

curl -L -O "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge-$(uname)-$(uname -m).sh

or, if this doesn’t work:

wget "https://github.com/conda-forge/miniforge/releases/latest/download/Mambaforge-$(uname)-$(uname -m).sh"
bash Mambaforge-$(uname)-$(uname -m).sh

The first command downloads the tool, and the second installs it. Follow the prompts on the installer screens.

If you are unsure about any setting, accept the defaults except for the last question asking you if you wish to run conda init: here, answer “yes”.

To make the changes take effect, close and then re-open your terminal window.

Testing your installation#

To see if everything worked well, open a terminal (Mac and Linux). On Windows, open the miniforge prompt (from the Start menu, search for and open “miniforge prompt”):

../_images/miniforge.png

and type in:

mamba list

You should see a long list of package names.

If you type:

python

A new python prompt should appear, with something like:

Python 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:15:42) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>

You can type exit() to get out of the python interpreter.

What is this python “interpreter”?#

Start with reading the definition from the Tech Terms Dictionary.

Put simple, the python interpreter is a program executing python programs or commands. It reads the programs you write and executes the instructions they contain. We will look into interpreters in a little more detail later in the semester, when we will talk about compiled and interpreted languages.

What is a “python installation”?#

Explanation for windows users : the difference between the command prompt, the miniforge prompt, and the python interpreter

Explanation for linux/mac users : what did mambaforge do to your terminal?

Learning checklist#