mirror of
https://gitlab.ewi.tudelft.nl/ee2l1/2025-2026/A.K.03.git
synced 2025-12-12 13:50:57 +01:00
499 lines
20 KiB
Plaintext
499 lines
20 KiB
Plaintext
{
|
||
"cells": [
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": ""
|
||
},
|
||
{
|
||
"cell_type": "markdown",
|
||
"metadata": {},
|
||
"source": [
|
||
"# Installation Guide for Windows\n",
|
||
"\n",
|
||
"As everyone is transitioning to Windows 11, this installation guide focuses on setting up the environment on Windows 11. The guide is also applicable to Windows 10, but some steps may differ slightly; we have added differing instructions whenever required.\n",
|
||
"\n",
|
||
"At the bottom of this guide, you will find a section on common problems and solutions. If you encounter any issues during the installation process, please refer to that section for troubleshooting tips.\n",
|
||
"\n",
|
||
"## Installing Python\n",
|
||
"\n",
|
||
"The first step in setting up your Python environment is to install the Python interpreter. For the best compatibility, everyone on the team should install the same version of Python. As of 2024, it is recommended that Python 3.12 be installed. The KITT simulator requires a Python version of 3.10 or newer, so any version older than 3.10 is strongly discouraged.\n",
|
||
"\n",
|
||
"1. **Install Python from the Microsoft Store**:\n",
|
||
"\n",
|
||
" - Open the Microsoft Store and search for \"Python\". Install **Python 3.12** by clicking on it and then selecting \"Get\" or \"Install\".\n",
|
||
"\n",
|
||
" - **Note**: Installing from the Microsoft Store ensures automatic updates and easy management. However, if you prefer, you can download Python directly from the [official website](https://www.python.org/downloads/windows/).\n",
|
||
"\n",
|
||
"2. **Verify the Installation**:\n",
|
||
"\n",
|
||
" - Open a command prompt:\n",
|
||
"\n",
|
||
" - Press the **Windows key**, type `cmd`, and hit **Enter**.\n",
|
||
"\n",
|
||
" - Type the following command and press **Enter**:\n",
|
||
"\n",
|
||
" ```bash\n",
|
||
" python --version\n",
|
||
" ```\n",
|
||
"\n",
|
||
" - This should display the installed Python version, e.g., `Python 3.12.0`. Please verify that the installed version matches the one you downloaded.\n",
|
||
"\n",
|
||
" - **Troubleshooting**:\n",
|
||
"\n",
|
||
" - If you receive an error like `'python' is not recognized as an internal or external command`, it means Python is not added to your system's PATH environment variable.\n",
|
||
"\n",
|
||
" - Follow this tutorial to [add Python to PATH](https://realpython.com/add-python-to-path/), or refer to the **Common Problems and Solutions** section below.\n",
|
||
"\n",
|
||
" - **Multiple Python Versions**:\n",
|
||
"\n",
|
||
" - If you have multiple versions of Python installed, you may need to specify `python3` instead of `python`:\n",
|
||
"\n",
|
||
" ```bash\n",
|
||
" python3 --version\n",
|
||
" ```\n",
|
||
"\n",
|
||
"## Installing Visual Studio Code\n",
|
||
"\n",
|
||
"It is recommended that you use Visual Studio Code (VSCode) as your Integrated Development Environment (IDE). VSCode is a free, open-source code editor developed by Microsoft with a wide range of extensions and excellent Python support.\n",
|
||
"\n",
|
||
"1. **Download VSCode**:\n",
|
||
"\n",
|
||
" - Open your web browser and navigate to the official VSCode website at [https://code.visualstudio.com/](https://code.visualstudio.com/).\n",
|
||
"\n",
|
||
" - Click on the \"**Download**\" button to download the installer suitable for your operating system.\n",
|
||
"\n",
|
||
"2. **Install VSCode**:\n",
|
||
"\n",
|
||
" - Once the installer is downloaded, run it to start the installation process.\n",
|
||
"\n",
|
||
" - **Installation Options**:\n",
|
||
"\n",
|
||
" - You can choose the default settings unless you have specific preferences.\n",
|
||
"\n",
|
||
" - **Recommended**: Check the option to \"Add to PATH\" during installation to allow you to open files and folders from the command line.\n",
|
||
"\n",
|
||
"3. **Launch VSCode**:\n",
|
||
"\n",
|
||
" - After the installation is complete, open Visual Studio Code.\n",
|
||
"\n",
|
||
"### Installing Python Extension for VSCode\n",
|
||
"\n",
|
||
"VSCode is very popular because of its use of extensions. This makes it compatible with almost any programming language or development board (such as Arduino). In our case, you have to add Python support to the IDE. Follow these steps:\n",
|
||
"\n",
|
||
"1. **Open VSCode**.\n",
|
||
"\n",
|
||
"2. **Access the Extensions View**:\n",
|
||
"\n",
|
||
" - Click on the Extensions icon in the Activity Bar (left side of the screen, a stack of blocks).\n",
|
||
"\n",
|
||
" - Or press **Control+Shift+X**.\n",
|
||
"\n",
|
||
"3. **Install the Python Extension**:\n",
|
||
"\n",
|
||
" - In the Extensions search bar, type **\"Python\"**.\n",
|
||
"\n",
|
||
" - Look for the official Python extension by Microsoft and click **\"Install\"**. This extension provides enhanced support for Python development, including IntelliSense, linting, debugging, and more.\n",
|
||
"\n",
|
||
"4. **Install the Jupyter Extension**:\n",
|
||
"\n",
|
||
" - In the same way, search for **\"Jupyter\"**.\n",
|
||
"\n",
|
||
" - Install the official Jupyter extension by Microsoft.\n",
|
||
"\n",
|
||
"5. **Reload VSCode**:\n",
|
||
"\n",
|
||
" - After installation, you may need to reload VSCode to activate the extensions fully.\n",
|
||
"\n",
|
||
" - If prompted, click on the **\"Reload\"** button.\n",
|
||
"\n",
|
||
"6. **Select the Python Interpreter**:\n",
|
||
"\n",
|
||
" - Open the Command Palette by pressing **Control+Shift+P**.\n",
|
||
"\n",
|
||
" - Type **\"Python: Select Interpreter\"** and select the Python 3.12 interpreter from the list.\n",
|
||
"\n",
|
||
" - If you don't see it, click on **\"Enter interpreter path\"** and navigate to your Python installation directory.\n",
|
||
"\n",
|
||
"## Cloning the Git Repository\n",
|
||
"\n",
|
||
"If you already have a way to work with Git repositories, you can skip to step 3. If you don't, follow these steps to clone the repository to your computer using VSCode's built-in Git support.\n",
|
||
"\n",
|
||
"1. **Open the Source Control View in VSCode**:\n",
|
||
"\n",
|
||
" - Click on the **Source Control** icon in the Activity Bar.\n",
|
||
"\n",
|
||
" - Or press **Control+Shift+G**.\n",
|
||
"\n",
|
||
"2. **Install Git (if not already installed)**:\n",
|
||
"\n",
|
||
" - If you don't have Git installed, VSCode will display a message and a **\"Download Git\"** button.\n",
|
||
"\n",
|
||
" - Click the button or download Git from [https://git-scm.com/download/win](https://git-scm.com/download/win).\n",
|
||
"\n",
|
||
" - **Git Installation Options**:\n",
|
||
"\n",
|
||
" - Run the installer and accept the default settings, except for the **default behavior of `git pull`**:\n",
|
||
"\n",
|
||
" - When prompted, select **\"Rebase\"** as the default behavior for `git pull`. This makes merging commits easier and keeps your commit history cleaner.\n",
|
||
"\n",
|
||
" - Ensure that the option **\"Use Git from the Windows Command Prompt\"** is selected to add Git to your system PATH.\n",
|
||
"\n",
|
||
" - **Restart VSCode** after installing Git to ensure it recognizes the Git installation.\n",
|
||
"\n",
|
||
"3. **Configure Git (First-Time Setup)**:\n",
|
||
"\n",
|
||
" - Set your Git user name and email:\n",
|
||
"\n",
|
||
" ```bash\n",
|
||
" git config --global user.name \"Your Name\"\n",
|
||
" git config --global user.email \"you@example.com\"\n",
|
||
" ```\n",
|
||
"\n",
|
||
"4. **Clone the Repository**:\n",
|
||
"\n",
|
||
" - Go to your assigned GitLab repository from the [EWI GitLab](https://gitlab.ewi.tudelft.nl/). Click to sign in with `TU Delft SSO NetID`. Browse to your IP3 project repository.\n",
|
||
"\n",
|
||
" - Click the blue **\"Clone\"** or **\"Code\"** button and copy the HTTPS URL.\n",
|
||
"\n",
|
||
"5. **Clone in VSCode**:\n",
|
||
"\n",
|
||
" - In the Source Control view of VSCode, click on **\"Clone Repository\"**.\n",
|
||
"\n",
|
||
" - Paste the URL you just copied and press **Enter**.\n",
|
||
"\n",
|
||
" - **Authentication**:\n",
|
||
"\n",
|
||
" - If prompted, enter your GitLab username and password.\n",
|
||
"\n",
|
||
" - If your account uses two-factor authentication, you may need to use a Personal Access Token instead of your password.\n",
|
||
"\n",
|
||
" - Choose a folder to download the project to.\n",
|
||
"\n",
|
||
"6. **Open the Cloned Repository**:\n",
|
||
"\n",
|
||
" - When asked, click **\"Open\"** to open the newly cloned repository.\n",
|
||
"\n",
|
||
" - If you're asked to trust the authors, please do so by clicking **\"Yes, I trust the authors\"**.\n",
|
||
"\n",
|
||
"## Installing Required Packages\n",
|
||
"\n",
|
||
"Python is a well-supported language with many possibilities. These possibilities come from the many libraries and packages that are built by users. Because we do not want to rewrite all the essentials, we will use a list of required packages that every user has to install.\n",
|
||
"\n",
|
||
"1. **Install the Microsoft Visual C++ Redistributable** (Windows 10 only):\n",
|
||
"\n",
|
||
" - Download and install the [Microsoft Visual C++ Redistributable](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist) if you haven't already.\n",
|
||
"\n",
|
||
" - This is required for compiling some Python packages.\n",
|
||
"\n",
|
||
"2. **Open the Project in VSCode**:\n",
|
||
"\n",
|
||
" - Open VSCode and navigate to the cloned repository.\n",
|
||
"\n",
|
||
"3. **Open a Terminal in VSCode**:\n",
|
||
"\n",
|
||
" - From the top menu, select **\"View\" > \"Terminal\"**.\n",
|
||
"\n",
|
||
" - Or press **Control+`** (the backtick key).\n",
|
||
"\n",
|
||
" - Ensure that the terminal is open in the root directory of your cloned repository (where the `requirements.txt` file is located).\n",
|
||
"\n",
|
||
"4. **Install the Required Packages**:\n",
|
||
"\n",
|
||
" - Run the following command:\n",
|
||
"\n",
|
||
" ```bash\n",
|
||
" pip install -r requirements.txt\n",
|
||
" ```\n",
|
||
" ```\n",
|
||
"\n",
|
||
"## Installing Sound Card Drivers\n",
|
||
"\n",
|
||
"For most audio measurements, we will be using the [Focusrite Scarlett 18i20](https://focusrite.com/products/scarlett-18i20) USB soundcard, shown in Fig. 1. \n",
|
||
"\n",
|
||
"It has 8 analog inputs (ADCs) and 10 analog outputs (DACs). \n",
|
||
"You connect it to your laptop/PC via a USB plug. \n",
|
||
"\n",
|
||
"---\n",
|
||
"\n",
|
||
"### Focusrite soundcard\n",
|
||
"\n",
|
||
"**(a)** \n",
|
||
"<img src=\"focusrite_front.JPG\" alt=\"Focusrite front\" width=\"60%\">\n",
|
||
"\n",
|
||
"**(b)** \n",
|
||
"<img src=\"focusrite_back.JPG\" alt=\"Focusrite back\" width=\"60%\">\n",
|
||
"\n",
|
||
"**Figure 1:** Focusrite soundcard — (a) front, and (b) backside. \n",
|
||
"\n",
|
||
"---\n",
|
||
"\n",
|
||
"The installation description given below has been checked for the **Windows 10** operating system. \n",
|
||
"It is expected that it is similar for **Windows 11** and for **Mac** computers. \n",
|
||
"For **Linux** machines, no driver installation is required. \n",
|
||
"\n",
|
||
"---\n",
|
||
"\n",
|
||
"### Setting up the control software\n",
|
||
"\n",
|
||
"When the soundcard is connected via USB, it will create a drive with a link to the Focusrite website. \n",
|
||
"From there you can download the proper Focusrite software package **“Focusrite Control”** for Windows or Mac. \n",
|
||
"\n",
|
||
"If this does not work, you can download the driver directly from: \n",
|
||
"[https://downloads.focusrite.com/focusrite/scarlett-3rd-gen/scarlett-18i20-3rd-gen](https://downloads.focusrite.com/focusrite/scarlett-3rd-gen/scarlett-18i20-3rd-gen) \n",
|
||
"\n",
|
||
"After installation, the following drivers are available: \n",
|
||
"- Windows driver \n",
|
||
"- Proprietary Focusrite ASIO driver \n",
|
||
"- Focusrite Control panel \n",
|
||
"\n",
|
||
"---\n",
|
||
"\n",
|
||
"Start *Focusrite Control* from your desktop. \n",
|
||
"\n",
|
||
"From the **Device** tab: \n",
|
||
"- Choose the sample rate and select **48 kHz**. \n",
|
||
"\n",
|
||
"Don’t change anything in the **Input settings**, i.e., Analog 1 and 2 are set to *Line* and the rest are off. \n",
|
||
"In **Output Routing**, the playback channels are routed to Outputs 1 + 2 — no change is needed. \n",
|
||
"\n",
|
||
"---\n",
|
||
"\n",
|
||
"In the Windows sound settings, you will initially see only two input channels: **Analog 1 + 2**. \n",
|
||
"To see all 8 analog input channels: \n",
|
||
"\n",
|
||
"1. Go to the **hidden icons** panel (bottom bar, at right). \n",
|
||
"2. Select the **“F”** icon and choose **Expose/Hidden Windows Channels**. \n",
|
||
"3. Check the boxes for **Analog 3 + 4**, **5 + 6**, and **7 + 8**. \n",
|
||
"\n",
|
||
"---\n",
|
||
"\n",
|
||
"Now open the soundcard settings panel: \n",
|
||
"**Start Menu → Control Panel → Sound → Recording**. \n",
|
||
"\n",
|
||
"Set **Analog 1 + 2** as *default*. Then: \n",
|
||
"\n",
|
||
"1. Select **Analog 1 + 2** and click **Properties**. \n",
|
||
"2. Under **Advanced**, choose **8 channel, 24 bit, 48000 Hz (Studio Quality)** as the *Default Format*. \n",
|
||
" - This allows recording from all 8 analog input channels in parallel. \n",
|
||
"3. Leave the *Advanced* window, go to **Level**, and make sure the recording level is set to **100 %**. \n",
|
||
"\n",
|
||
"---\n",
|
||
"\n",
|
||
"### Drivers\n",
|
||
"\n",
|
||
"For recording the eight input signals (**Analog 1 – 8**) simultaneously, the **Focusrite ASIO driver** must be used. \n",
|
||
"\n",
|
||
"A different ASIO driver (e.g., **ASIO4ALL**) will **not** work and must be removed. \n",
|
||
"\n",
|
||
"\n",
|
||
"## Common Problems and Solutions\n",
|
||
"\n",
|
||
"### Problem 1: `'python' is not recognized as an internal or external command`\n",
|
||
"\n",
|
||
"**Solution**:\n",
|
||
"\n",
|
||
"- **Cause**: Python is not added to your system's PATH environment variable.\n",
|
||
"\n",
|
||
"- **Fix**:\n",
|
||
"\n",
|
||
" 1. **Add Python to PATH**:\n",
|
||
"\n",
|
||
" - Go to **Control Panel** > **System and Security** > **System** > **Advanced system settings**.\n",
|
||
"\n",
|
||
" - Click on **\"Environment Variables\"**.\n",
|
||
"\n",
|
||
" - Under **\"System variables\"**, find **\"Path\"** and click **\"Edit\"**.\n",
|
||
"\n",
|
||
" - Click **\"New\"** and add the path to your Python installation (e.g., `C:\\Users\\<YourUsername>\\AppData\\Local\\Programs\\Python\\Python312\\`).\n",
|
||
"\n",
|
||
" 2. **Reinstall Python with PATH Option**:\n",
|
||
"\n",
|
||
" - Re-run the Python installer.\n",
|
||
"\n",
|
||
" - Check the option that says **\"Add Python 3.12 to PATH\"**.\n",
|
||
"\n",
|
||
" 3. **Verify**:\n",
|
||
"\n",
|
||
" - Open a new command prompt and type `python --version`.\n",
|
||
"\n",
|
||
"### Problem 2: `'pip' is not recognized as an internal or external command`\n",
|
||
"\n",
|
||
"**Solution**:\n",
|
||
"\n",
|
||
"- **Cause**: `pip` is not added to your system's PATH or not installed.\n",
|
||
"\n",
|
||
"- **Fix**:\n",
|
||
"\n",
|
||
" 1. **Use Python to Access pip**:\n",
|
||
"\n",
|
||
" ```bash\n",
|
||
" python -m pip install --upgrade pip\n",
|
||
" ```\n",
|
||
"\n",
|
||
" 2. **Ensure pip is Installed**:\n",
|
||
"\n",
|
||
" - Download `get-pip.py` from [https://bootstrap.pypa.io/get-pip.py](https://bootstrap.pypa.io/get-pip.py).\n",
|
||
"\n",
|
||
" - Run the script:\n",
|
||
"\n",
|
||
" ```bash\n",
|
||
" python get-pip.py\n",
|
||
" ```\n",
|
||
"\n",
|
||
"### Problem 3: Multiple Python Versions Causing Confusion\n",
|
||
"\n",
|
||
"**Solution**:\n",
|
||
"\n",
|
||
"- **Cause**: Multiple Python installations can lead to conflicts.\n",
|
||
"\n",
|
||
"- **Fix**:\n",
|
||
"\n",
|
||
" 1. **Check Python Installations**:\n",
|
||
"\n",
|
||
" ```bash\n",
|
||
" where python\n",
|
||
" ```\n",
|
||
"\n",
|
||
" - This will list all Python executables in your PATH.\n",
|
||
"\n",
|
||
" 2. **Specify Full Path**:\n",
|
||
"\n",
|
||
" - Use the full path to the desired Python version:\n",
|
||
"\n",
|
||
" ```bash\n",
|
||
" \"C:\\Users\\<YourUsername>\\AppData\\Local\\Programs\\Python\\Python312\\python.exe\" --version\n",
|
||
" ```\n",
|
||
"\n",
|
||
" 3. **Adjust PATH Environment Variable**:\n",
|
||
"\n",
|
||
" - Ensure that the path to Python 3.12 is higher in the PATH order.\n",
|
||
"\n",
|
||
"### Problem 4: Git is Not Recognized or Installation Issues\n",
|
||
"\n",
|
||
"**Solution**:\n",
|
||
"\n",
|
||
"- **Cause**: Git is not installed or not added to PATH.\n",
|
||
"\n",
|
||
"- **Fix**:\n",
|
||
"\n",
|
||
" 1. **Install Git**:\n",
|
||
"\n",
|
||
" - Download from [https://git-scm.com/download/win](https://git-scm.com/download/win).\n",
|
||
"\n",
|
||
" - During installation, select **\"Use Git from the Windows Command Prompt\"**.\n",
|
||
"\n",
|
||
" 2. **Verify Git Installation**:\n",
|
||
"\n",
|
||
" ```bash\n",
|
||
" git --version\n",
|
||
" ```\n",
|
||
"\n",
|
||
" 3. **Restart VSCode** to recognize the Git installation.\n",
|
||
"\n",
|
||
"### Problem 5: Errors When Installing Packages from `requirements.txt`\n",
|
||
"\n",
|
||
"**Solution**:\n",
|
||
"\n",
|
||
"- **Cause**: Missing dependencies or incompatible package versions.\n",
|
||
"\n",
|
||
"- **Fix**:\n",
|
||
"\n",
|
||
" 1. **Read Error Messages Carefully**:\n",
|
||
"\n",
|
||
" - Identify which package is causing the issue.\n",
|
||
"\n",
|
||
" 2. **Install Microsoft Visual C++ Redistributable**:\n",
|
||
"\n",
|
||
" - Download from [Microsoft's website](https://learn.microsoft.com/en-us/cpp/windows/latest-supported-vc-redist).\n",
|
||
"\n",
|
||
" 3. **Install Packages Individually**:\n",
|
||
"\n",
|
||
" - Remove the problematic package from `requirements.txt`.\n",
|
||
"\n",
|
||
" - Try installing problematic packages one by one for detailed errors:\n",
|
||
"\n",
|
||
" ```bash\n",
|
||
" pip install package_name\n",
|
||
" ```\n",
|
||
"\n",
|
||
" - Ask a TA for help if needed.\n",
|
||
"\n",
|
||
"\n",
|
||
"### Problem 6: VSCode Does Not Detect the Python Interpreter\n",
|
||
"\n",
|
||
"**Solution**:\n",
|
||
"\n",
|
||
"- **Cause**: VSCode can't find the Python installation.\n",
|
||
"\n",
|
||
"- **Fix**:\n",
|
||
"\n",
|
||
" 1. **Select Interpreter Manually**:\n",
|
||
"\n",
|
||
" - Press **Control+Shift+P** to open the Command Palette.\n",
|
||
"\n",
|
||
" - Type **\"Python: Select Interpreter\"**.\n",
|
||
"\n",
|
||
" - Choose the correct Python 3.12 interpreter.\n",
|
||
"\n",
|
||
" 2. **Install the Python Extension**:\n",
|
||
"\n",
|
||
" - Ensure the official Python extension by Microsoft is installed.\n",
|
||
"\n",
|
||
" 3. **Restart VSCode**.\n",
|
||
"\n",
|
||
"### Problem 7: VSCode Does Not Detect Git\n",
|
||
"\n",
|
||
"**Solution**:\n",
|
||
"\n",
|
||
"- **Cause**: Git is not installed or not in PATH.\n",
|
||
"\n",
|
||
"- **Fix**:\n",
|
||
"\n",
|
||
" 1. **Install Git** if not already installed.\n",
|
||
"\n",
|
||
" 2. **Add Git to PATH**:\n",
|
||
"\n",
|
||
" - Ensure that the Git installation directory is added to your system's PATH environment variable.\n",
|
||
"\n",
|
||
" - Go to: `Control Panel` > `System and Security` > `System` > `Advanced system settings` > `Environment Variables`.\n",
|
||
"\n",
|
||
" - Under **\"System variables\"**, find **\"Path\"** and click **\"Edit\"**.\n",
|
||
"\n",
|
||
" - Click **\"New\"** and add the path to your Git installation (e.g., `C:\\Program Files\\Git\\bin`).\n",
|
||
"\n",
|
||
" 3. **Configure Git Path in VSCode**:\n",
|
||
"\n",
|
||
" - Go to **\"Settings\"** in VSCode.\n",
|
||
"\n",
|
||
" - Search for **\"git.path\"** and set it to the path of your `git.exe` (e.g., `C:\\Program Files\\Git\\bin\\git.exe`).\n",
|
||
"\n",
|
||
"---\n",
|
||
"\n",
|
||
"**Note**: If you encounter issues not covered in this guide, please reach out to a TA for assistance. Providing screenshots of error messages can help diagnose problems more quickly."
|
||
]
|
||
}
|
||
],
|
||
"metadata": {
|
||
"kernelspec": {
|
||
"display_name": "OpenEdVenv",
|
||
"language": "python",
|
||
"name": "python3"
|
||
},
|
||
"language_info": {
|
||
"codemirror_mode": {
|
||
"name": "ipython",
|
||
"version": 3
|
||
},
|
||
"file_extension": ".py",
|
||
"mimetype": "text/x-python",
|
||
"name": "python",
|
||
"nbconvert_exporter": "python",
|
||
"pygments_lexer": "ipython3",
|
||
"version": "3.12.6"
|
||
}
|
||
},
|
||
"nbformat": 4,
|
||
"nbformat_minor": 2
|
||
}
|