Setting Up Python & JupyterLab
Environment
Introduction
Python and JupyterLab are powerful tools used for data analysis, scientific computing, and
machine learning. This guide provides step-by-step instructions for installing Python and
JupyterLab on Windows, Linux, and Mac.
Table of Contents
- Installation in linux
- Installation in windows
- installation in mac
Step-by-Step Guide
Linux:
Install Python:
sudo apt update
sudo apt install python3
python3 --version
Install Virtual Environment:
sudo apt update
sudo apt install python3-venv
Create a virtual environment directory:
mkdir myvenv
Create a virtual environment (optional method):
sudo apt install python3-pip
sudo pip3 install virtualenv
Create a Virtual Environment (Isolated Installation):
python3 -m venv summerofai
Activate the Virtual Environment:
source summerofai/bin/activate
Install virtualenv within the Virtual Environment:
pip install virtualenv
pip install virtualenv –break-system-packages
Install JupyterLab
Install JupyterLab approach with a virtual environment:
sudo apt update
sudo apt install python3 ( no need if already done )
Create a Virtual Environment:
python3 -m venv jupyterlab_env # Replace "jupyterlab_env" with your desired name
Activate the Virtual Environment:
source jupyterlab_env/bin/activate
Install JupyterLab within the Virtual Environment:
pip3 install jupyterlab
Launch JupyterLab:
jupyter lab
A new tab will open in your default web browser with JupyterLab.
Windows:
Install python:
- Download the latest version of Python from the official website:
https://www.python.org/downloads/
- Choose the installation based on your system ( 32 bits or 64 bits )
- Click on the downloaded .exe file
- Run the installer and ensure you check the box to "Add Python to PATH" during
installation. This allows you to run Python commands from the Command Prompt.
- Complete the installation process. Until installation window to finish
exit from python environment : 'exit()'
Install Virtual Environment:
Copy the path to the python folder
for ex- C:\Users\shrey\AppData\Roaming\Microsoft\Windows\Start Menu
Open command prompt:
cd C:\Users\shrey\AppData\Roaming\Microsoft\Windows\Start Menu
py -m venv .venv
.venv\Scripts\activate
where python
.venv\Scripts\python
exit()
py -m venv summerofai
pip install virtualenv
py -m pip install --upgrade pip
py -m pip --version
Create Virtual Environment :
python -m venv summerofai
Activate Virtual Environment :
summerofai\Scripts\activate
Install JupyterLab: In Command Prompt, run:
pip install jupyterlab
Launch JupyterLab: In Command Prompt, run:
jupyter lab
A new tab will open in your default web browser with JupyterLab.
Mac:
Install python:
Install Homebrew by running the following command:
/bin/bash -c "$(curl -fsSL
https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Once Homebrew is installed, you can install Python by running:
brew install python
Install Virtual Environment:
pip3 install virtualenv
Create Virtual Env:
virtualenv summerofai
Activate Virtual Env:
source summerofai/bin/activate
Install JupyterLab:
pip3 install jupyterlab
Launch JupyterLab:
jupyter lab
A new tab will open in your default web browser with JupyterLab.
Troubleshooting
• Command not found: Ensure Python and pip are installed and added to your
system PATH.
• Permission issues: Try running commands with sudo on Linux and Mac if you
encounter permission errors.
• Browser doesn't open: Copy the URL provided in the terminal and paste it into
your web browser manually.