How to Jupyter¶

Jupyter Notebook is an open-source web application that allows you to create and share documents containing live code, equations, visualizations, and narrative text.

It's widely used for interactive computing, data analysis, scientific research, education, and data visualization.

Some key features and components of Jupyter Notebook includes:


At the bottom left is a control pad with which you can navigate through the slides.

(How to create slides will be explained later.)

  1. Interactive Environment
  2. Support for Multiple Programming Languages
  3. Rich Text Support
  4. Data Visualization
  5. Equation Rendering
  6. Easy Sharing
  7. Notebook Extensions
  8. Data Analysis and Exploration
  9. Education and Learning

Install Python¶

In this module we will learn the programming language Python. To do this, we need to install it on our system in order to be able to use Jupyter Notebook in advance.

The Python.org website contains a download link for each operating system. Under www.python.org/downloads/ you can download the latest Python version.

After following the installation wizard (this depends heavily on which operating system you are using, so we do not show this here), you have successfully installed Python.

Opening a Terminal¶

Windows:

  1. Press Start (⊞ - Windows Symbol) -> type and search for cmd
  2. Or Press the Windows Symbol ⊞ + the R key (Windows + R) -> type cmd in the window that appeard -> press Enter

Mac:

Open launchpad and Search for Terminal

Linux:

It depends on your Environment. But Ctrl + Alt + T should do the Trick on every System.

Upgrading Pip and Installing Jupyter¶


Pip - Python Package Index¶

pip is the de-facto and recommended package management programme for Python packages from the Python Package Index (PyPI). At the beginning, the project was called "pyinstall".

It's website is found under pypi.org. Every Package you need, can and should be derived from PyPI.


After opening the terminal, pip should first be updated to the latest version. To do this, enter the command:

python3 -m pip install -U pip

Requirement already satisfied: pip in /home/phil/Desktop/einfuhrung-in-die-programmierung/env/lib/python3.11/site-packages (23.2.1)

Installing Jupyter¶

Now we can install some software we only need two packages depending on your need.

virtualenv is a tool to create isolated Python environments. You can read more about it in the Virtualenv documentation.

  1. We need to install the package virtualenv (venv)

python3 -m pip install virtualenv

  1. Now we can create an virtual environment in any folder we want. (A good practice is a venv for every project)

python3 -m venv env

the name env is the folder which has all of our environment information, it can be named everything, but for convinence env should be used.

  1. After installing virtualenv we need to activate it

Windows: .\env\Scripts\activate

Linux / Mac: source env/bin/activate

your command prompt will be modified to reflect the change.

  1. Now you can install jupyter and other dependencies without tinkering with your system

pip install jupyterlab

-> We can use pip direct because we specified the python version with venv implicitly.

Starting Jupyter for the first time¶

the last thing we need to tab out of the command line is to start Jupyter

therefor type jupyter lab and Enter. Do not close the command line it will stop jupyter!

After a little waiting time jupyter prompts you with messages one of them should look like:

http(s)://<server:port>/<lab-location>/lab

copy the url and open it in your Webbrowser of Choice. Now we can Proceed.

Note: This step needs to be done everytime you want to start Jupyter!


Alternatives¶

(Mini)conda¶

conda from Ananconda Inc. is an open source package and environment manager for many languages that encludes everything we needs.

For most purposes miniconda should do the trick. You can download it here conda docs

After installing you can change every python3 -m pip and pip command with conda.

Jupyter Lab Desktop¶

As there description on GitHub stated

JupyterLab Desktop is the cross-platform desktop application for JupyterLab. It is the quickest and easiest way to get started with Jupyter notebooks on your personal computer, with the flexibility for advanced use cases.

its nothing else than a selfcontained webbrowser bundeld with Jupyter Lab. You can download a binary for your operating System under there GitHub Releases page.

Note¶

Every Process has its Advantages and Disadvantages and depends on your needs and workflow.

The easiest way isn't always the best.

If you have no command line experience try to get used to it and don't use Jupyter Lab Desktop.