PDAI Setup your machine - EMbeDS-education/ComputingDataAnalysisModeling20242025 GitHub Wiki
This page explains how to install Python and the JupyterLab editor on your machine. You have two options:
- install a standalone desktop application for JupyterLab that already includes a Python environment:
- manually install Python and Jupyterlab.
You don't need any installation if you only use Colab
Used Jupyter notebooks will be made available with suitable links
We suggest this option
- Support for debugger and further advanced features!
- Visit the download page of Visual Studio Code https://code.visualstudio.com/Download
- Download and install the right distribution
- Open Visual Studio Code,
- Click on Extensions (the for squares in the picture), write
@recommended:languages
(with no spaces before and after) - Install both Python and Jupyter
- You should now be good to go
- Click on Extensions (the for squares in the picture), write
- Visit the JupyterLab Desktop
- Download the version for your machine
- Install the downloaded package
- JupyterLab Desktop can be launched from the GUI of your operating system by clicking the application's icon, or by double clicking on a .ipynb file!
- Visit the download page of Python
- Download the version 3.9.10 of Python for your machine
- Install the downloaded package
- If requested, select 'Add Python to PATH'
- If requested, disable path length limit
- Test your Python installation
- Open a terminal (Unix, Mac OS) or command prompt (Windows - just search for cmd)
- Type
python3 --version
. You should get:Python 3.9.10
- Otherwise type
python --version
. You should get:Python 3.9.10
- NOTE: In the rest of this page we will refer as
python3
to eitherpython
orpython3
as used in these steps
- NOTE: In the rest of this page we will refer as
- Restart your machine
-
Open a terminal/command prompt
-
Install jupyter typing
python3 -m pip install jupyterlab
- [Optional] Update pip if a warning is provided typing
python3 -m pip install --upgrade pip
- [Optional] Update pip if a warning is provided typing
-
[Optional] It is convenient to install ipykernel and to add a new kernel for this course. This will help you maintaining a clean Python installation
- Open a terminal/command prompt and move to a directory where you want to store configurations for this course (not the code):
cd the/directory/path
- Create a new virtual environment:
python3 -m venv env_pdai_2024
- Then activate it:
- Linux/Mac:
source env_pdai_2024/bin/activate
- Windows:
env_pdai_2024\Scripts\activate
- Linux/Mac:
- Install ipykernel:
python3 -m pip install ipykernel
- Install a new kernel
python3 -m ipykernel install --user --name=env_pdai_2024
- Deactivate the virtual environment:
- Linux/Mac:
deactivate
- Windows:
env_pdai_2024\Scripts\deactivate.bat
- Linux/Mac:
- Open a terminal/command prompt and move to a directory where you want to store configurations for this course (not the code):
-
[Optional] Install additional useful jupyter-lab extension
- Install a spell-checker for Markdown cells
python3 -m pip install jupyter_contrib_nbextensions
pip install jupyterlab-spellchecker
jupyter contrib nbextension install --user
jupyter nbextension enable spellchecker/main
- Install a debugger (only for jupyter-lab 3 or superior)
python3 -m pip install xeus-python notebook
- Install a spell-checker for Markdown cells
At this point, you can start jupyter-lab in any directory of your choice, create a new notebook and select the kernel
- It might happen that the spell-checker does not get correctly installed.
- Please click on the 'puzzle' icon shown below, enable extensions if asked, and search and the jupyter_lab_spellchecker plugin shown in the picture
- Open a terminal/command prompt
- Launch jupyter typing
jupyter-lab
- A web browser should open showing something like
- Click on the Python logo with name env_pdai_2024 (or on the one named Python 3)
- Next to '[ ]:' type
print('Hello, world!')
- Click on the Run icon (the gray triangle above the editor). You should get:
Install Disco
- If you have a @santannapisa.it email, you can get an Academic Alliance for free
- If not, the demo version is enough for the sake of this course.
Install PM4Py
- It is a python library. In our notebooks you will find the instructions to install it