Installing Jupyter#

This chapter contains some instructions about how to install additional useful tools which will enhance your python installation a great deal!

Prerequisites#

I’ll assume that the python installation instructions from last week have worked for you, and that you:

  • are able to start a miniforge prompt

  • can type mamba list successfully

  • can type python and open an interpreter.

Explanation: the difference between the command prompt, the miniforge prompt, and the python interpreter#

Many of you have opened a prompt (a terminal) for the first time in this class. When I was a child and my parents bought our first computer, opening a terminal was very normal and even needed to play games!

There is nothing to be afraid of. You will use the prompt very often, but you won’t need it for anything else than starting python, jupyterlab, or any other python tool of your choice.

The command prompt (or cmd.exe)#

You will find it by typing cmd in the windows search bar:

../_images/cmd.png

In the command prompt, you can do many things, but the one thing you’ll really need is to navigate to the folder of your choice. The name of the currently active folder is always indicated at the start of the command line.

Only a few commands are necessary for this class:

  • help: seeing the list of commands available

  • dir: list the directories (folders) in the current location

  • cd FolderName: navigate to the folder FolderName

  • cd ..: navigate one folder up

  • TAB: ask the command prompt to complete the name for you. For example, if you are lazy and type two letters of the desired folder only, typing TAB might complete it for you

  • exit: exit the prompt (you can also simply close the window)

That’s it! The reason why you need to be able to navigate to a specific folder will be explained in the next lesson.

The miniforge prompt#

You will find it by typing “miniforge” in the windows search bar:

../_images/miniforge.png

You will recognize that you are in a miniforge prompt by the title of the window and the (base) text before the location:

../_images/term.png

The miniforge prompt is exactly like the command prompt, BUT it has python installed in it. All the commands explained above work in the miniforge prompt as well, but these new commands are now available to you:

  • all the mamba commands (mamba list, mamba install, …)

  • opening a python interpreter (python, and later today also ipython, jupyter-lab)

In practice, you will actually never open the command prompt, but always the miniforge prompt. You will use it to navigate to a folder and then start a python interpreter.

The python interpreter#

The python interpreter can be opened in many different ways, but the way you learn first is to start it from the miniforge prompt. The python interpreter is recognizable by the three “great than” sign at the beginning of the command line >>>. The python interpreter is where the python commands are valid.

Be aware of the context

Be aware of the interpreter your are using. To summarize:

  • In the command prompt, you can navigate between folders (cd, dir, etc.)

  • In the miniforge prompt, you can navigate between folders AND you can install python packages (mamba) and start python (python or jupyter-lab)

  • In the python interpreter, you can type python commands and much much more

Install ipython and jupyterlab#

ipython and jupyter are fundamental tools of a scientific python installation. We will use them a LOT during the semester and your studies. I will make a demonstration in class, but first you have to install it! From the miniforge prompt, type:

mamba install jupyterlab

This will install both jupyter-lab and ipython at the same time. To check if it worked, type:

ipython

Which should display something like:

Python 3.9.7 | packaged by conda-forge | (default, Sep 29 2021, 19:15:42) [MSC v.1916 64 bit (AMD64)]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.1.1 -- An enhanced Interactive Python. Type '?' for help.

In [1]:

The only visual difference between the ipython and python interpreters is that >>> has been replaced by In [1]:. More on this later.

Exit ipython (remember how? Use exit()), and then type:

jupyter-lab

This should open a new window in your default web browser! If all of this worked properly, you are good to go for today.

Learning summary#

  • you know how to install jupyter on your computer and start ipython and jupyter-lab