> For the complete documentation index, see [llms.txt](https://docs.vbase.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.vbase.com/technical-reference/windows_subsystem_for_linux_guide.md).

# Windows Subsystem for Linux (WSL) Guide

This tutorial guides you through setting up Windows Subsystem for Linux (WSL) to run vBase samples.

## 1. Install Windows subsystem for Linux (WSL) <a href="#install-windows-subsystem-for-linux-wsl" id="install-windows-subsystem-for-linux-wsl"></a>

1. **Open PowerShell as Administrator:** Right-click the Start button and select “Windows PowerShell (Admin)”.
2. **Enable WSL**: Type the following command into PowerShell and press Enter:

   ```powershell
   dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
   ```
3. **Enable VirtualMachinePlatform Feature:** Type the following command into PowerShell and press Enter:

   ```powershell
   dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
   ```
4. **Restart your PC.**
5. **Download and Install a Linux Distribution:** Go to the Microsoft Store, search for the Ubuntu Linux distribution, and install it.
6. **Set WSL 2 as your default version:** Open PowerShell as Administrator again and run:

   ```powershell
   wsl --set-default-version 2
   ```
7. **Launch WSL:** After installation, launch WSL from the Start menu. The first launch will take some time due to setup. You will be prompted to create a user account and password.

## 2. Install Python <a href="#install-python" id="install-python"></a>

> **Note:** The following steps assume you have WSL installed and are running commands in the open WSL console window.

1. **Update and Upgrade Packages:** Update your Linux package list and upgrade the packages by running:

   ```bash
   sudo apt update && sudo apt upgrade -y
   ```
2. **Install Python3 and pip:** Run the following command:

   ```bash
   sudo apt install python3 python3-pip python3-venv -y
   ```

## 3. Install Git <a href="#install-git" id="install-git"></a>

1. **Install Git:** Run the following command to install git:

   ```bash
   sudo apt install git -y
   ```

## 4. Clone the vbase-py-samples Git repository <a href="#clone-the-vbase-py-samples-git-repository" id="clone-the-vbase-py-samples-git-repository"></a>

1. **Create the vBase directory:** Create the directory where you want to clone vBase repositories and switch to this directory by running:

   ```bash
   mkdir ~/validityBase && cd ~/validityBase
   ```
2. **Clone the Repository:** Once you are in the directory where you want to clone the repository, run:

   ```bash
   git clone https://github.com/validityBase/vbase-py-samples
   ```

## 5. Install the samples <a href="#install-the-samples" id="install-the-samples"></a>

1. **Navigate to the Repository Directory:**

   ```bash
   cd ~/validityBase/vbase-py-samples
   ```
2. **Create a virtual environment and install the dependencies:**

   ```bash
   python3 -m venv venv
   source venv/bin/activate
   python -m pip install -r requirements.txt
   python -m pip install jupyterlab
   ```
3. **Configure your API key:**

   ```bash
   cp .env.example .env
   ```

   Open `.env` in an editor and set `VBASE_API_KEY` to the key from [vBase Account Settings](https://app.vbase.com/profile/#account_settings). Do not commit `.env`.

## 6. Run Jupyter Lab and open a notebook <a href="#run-jupyter-lab-and-open-a-notebook" id="run-jupyter-lab-and-open-a-notebook"></a>

1. **Navigate to the Repository Directory:**

   ```bash
   cd ~/validityBase/vbase-py-samples
   source venv/bin/activate
   ```
2. **Run Jupyter Lab:** Start Jupyter Lab by running:

   ```bash
   jupyter lab
   ```

   This command will start Jupyter Lab and provide you with a URL (including a security access token) to access it from your browser.
3. **Access Jupyter Lab:** Copy the provided URL and paste it into your browser’s address bar to access Jupyter Lab.
4. **Open a Notebook:** In Jupyter Lab, navigate through the file explorer to find the notebook you wish to open in the `~/validityBase/vbase-py-samples/samples` folder. Click on it to open and interact with the notebook.
