# Troubleshooting

Here are some common errors and how to solve them.

First thing first, please make sure that the `requirements.txt` only contains these packages:

```
# Core Packages
numpy
pandas
matplotlib
seaborn
scipy

# Machine Learning
scikit-learn

# Data Processing & Analysis
sqlalchemy
```

Try creating the environment and downloading the dependency again <a href="../setup-git-in-vs-code#step-4-create-a-virtual-environment" class="button primary">Create a Virtual Environment</a>

{% tabs %}
{% tab title="Windows" %}

<details>

<summary>Error: <code>ExecutionError</code></summary>

<figure><img src="https://2669499530-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnYNN3nXNuXMJpHACcH73%2Fuploads%2FFTJOKbSbiQJxAFve4oGX%2Fimage.png?alt=media&#x26;token=c6170a3d-b65a-40d6-b309-35e8c54e6314" alt=""><figcaption></figcaption></figure>

(Also as known as: <mark style="color:red;">Running scripts is disabled / Ausführung von Skripts auf diesem System deaktiviert</mark>)

**To solve this issue, follow these steps:**

1. **Open PowerShell as Administrator**:
   * Right-click on the Windows Start menu.
   * Select **Windows PowerShell (Admin)** or **PowerShell (Admin)**.
2. **Check the current Execution Policy**: Enter this command and press Enter:

```powershell
Get-ExecutionPolicy
```

If it shows `Restricted`, that means script execution is disabled.

1. **Change the Execution Policy temporarily**:\
   To allow the script to run, enter this command and press Enter:

   ```powershell
   Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
   ```

   * Type **Y** when prompted. (or **J** in German)
   * This change is applied only for the current user and allows running locally created scripts.
2. **Activate your virtual environment**:\
   Now try to activate it again:

   ```powershell
   .\venv\Scripts\Activate

   or
   .\venv\Scripts\activate
   ```

</details>

<details>

<summary>Error: <code>pip: command not found</code></summary>

#### **Cause:**

* `pip` is not installed or not linked to Python's PATH.

#### **Solution:**

1. **Check pip installation:**

   ```powershell
   python -m pip --version
   ```
2. **If not installed, install it:**

   ```powershell
   python -m ensurepip --upgrade
   ```
3. **If still not recognized, reinstall pip:**

   ```powershell
   curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
   python get-pip.py
   ```
4. **If path issues persist, add to PATH manually:**

   ```powershell
   setx PATH "%PATH%;C:\Users\<YourUsername>\AppData\Local\Programs\Python\Python39\Scripts"
   ```
5. **Restart your terminal and verify:**

   ```powershell
   pip --version
   ```

</details>

<details>

<summary>Error: <code>ModuleNotFoundError</code> After Activation</summary>

**Error Message:**

```
ModuleNotFoundError: No module named 'pandas'
```

**Cause:**

* Dependencies are not installed inside the virtual environment.

**Solution:**

* Ensure the environment is activated:

  ```bash
  .\venv\Scripts\Activate

  # Or
  .\venv\Scripts\activate
  ```
* Install your dependencies:

  ```bash
  pip install pandas
  ```

</details>
{% endtab %}

{% tab title="MacOS" %}

<details>

<summary>Error: <code>ExecutionError</code></summary>

**Error Message:**

```bash
permission denied: ./venv/bin/activate
```

**Cause:**

* The `activate` script does not have execution permissions.

**Solution:**

* Navigate to your project directory:

  ```bash
  cd path/to/your/project
  ```
* Give execute permissions to the `activate` script:

  ```bash
  chmod +x venv/bin/activate
  ```
* Activate the environment:

  ```bash
  source venv/bin/activate
  ```

</details>

<details>

<summary>Error: <code>pip: command not found</code></summary>

**Error Message:**

```bash
zsh: command not found: pip
```

**Cause:**

* pip is not linked to Python or not installed.

**Solution:**

* Use `python3` to call pip directly:

  ```bash
  python3 -m pip install --upgrade pip
  ```
* Alternatively, install it:

  ```bash
  sudo easy_install pip
  ```

</details>

<details>

<summary>Error: <code>ModuleNotFoundError</code> After Activation</summary>

**Error Message:**

```bash
ModuleNotFoundError: No module named 'pandas'
```

**Cause:**

* Dependencies are not installed inside the virtual environment.

**Solution:**

* Ensure the environment is activated:

  ```bash
  source venv/bin/activate
  ```
* Install your dependencies:

  ```bash
  pip install pandas
  ```

</details>
{% endtab %}
{% endtabs %}

{% hint style="info" %}
Tip: **Resetting VS Code** helps in some cases:

* If you don't see some of the options in the guide, despite having done everything, try **reseting VS Code** by turning it off and on again.
* If you have installed Git but cannot see some option
* If you have created a virtual environment but cannot find it
  {% endhint %}
