An open API service indexing awesome lists of open source software.

https://github.com/zebbern/pip-error-fixes

🛠️ | Pip errors fixes. Includes common fixes, error resolutions!
https://github.com/zebbern/pip-error-fixes

cheet-sheet dependency-managment fixes pip pip-error pip-install pip-install-error pip-issue pip-package pip-update pip3 pip3-error pip3-update pipenv python-errors troubleshooting virtual-environment

Last synced: 4 months ago
JSON representation

🛠️ | Pip errors fixes. Includes common fixes, error resolutions!

Awesome Lists containing this project

README

          

![Python](https://img.shields.io/badge/Python-3.x-blue)
![Status](https://img.shields.io/badge/Status-Active-green)
![License](https://img.shields.io/badge/License-MIT-brightgreen)

## ![Linux|MacOS|Windows](https://img.shields.io/badge/Linux|MacOS|Windows-Fix-black)

**[Activate Virtual Environment Before Installing Pip Libs](#virtual-environment-activate)**

**Activating a `virtual env` usually fixes Most `pip install errors`**

**If that does not work look for your issue under!**

> [!Tip]
> - **Try multiple fixes listed in the repository!**
> - **Sometimes there's only one specific way to install the `pip-lib` you're trying to get.**

---

## [Windows Fixes](#windows11) ➠ ![Windows](https://img.shields.io/badge/Windows-Fixes-blue)
- **If [Activate Virtual Environment](#virtual-environment-activate) did not work you can try these:**

- [ModuleNotFoundError](#modulenotfounderror)
- [ERROR: Could not install packages due to an EnvironmentError](#error-could-not-install-packages-due-to-an-environmenterror)
- [ERROR: Command errored out with exit status 1](#error-command-errored-out-with-exit-status-1)
- [ERROR: pip is configured with locations that require TLS/SSL](#error-pip-is-configured-with-locations-that-require-tlsssl)
- [SSL Certificate Verification Error](#ssl-certificate-verification-error)
- [UnicodeDecodeError](#unicodedecodeerror)
- [error: Microsoft Visual C++ 14.0 or greater is required](#error-microsoft-visual-c-140-or-greater-is-required)
- [pip freeze` not displaying packages](#pip-freeze-not-displaying-packages)
- [break system packages error windows](#break-system-packages-error-windows)

---

## [Linux/macOS Fixes](#linux12) ➠ ![Linux|MacOS](https://img.shields.io/badge/Linux|MacOS-Fixes-black)
- **If [Activate Virtual Environment](#virtual-environment-activate) did not work you can try these:**

- [ModuleNotFoundError](#modulenotfounderror-1)
- [ERROR: Could not install packages due to an EnvironmentError](#error-could-not-install-packages-due-to-an-environmenterror-1)
- [ERROR: Command errored out with exit status 1](#error-command-errored-out-with-exit-status-1-1)
- [ERROR: pip is configured with locations that require TLS/SSL](#error-pip-is-configured-with-locations-that-require-tlsssl-1)
- [SSL Certificate Verification Error](#ssl-certificate-verification-error-1)
- [UnicodeDecodeError](#unicodedecodeerror-1)
- [`fatal error: Python.h: No such file or directory](#fatal-error-pythonh-no-such-file-or-directory)
- [pip freeze not displaying packages](#pip-freeze-not-displaying-packages-1)
- [break system packages error linux](#break-system-packages-error-linux)

---

## [Pip Tips](#piptips) ➠ ![Linux|MacOS|Windows](https://img.shields.io/badge/Linux|MacOS|Windows-Fix-black)
- **Recommended to always [Activate Virtual Environment](#virtual-environment-activate) before installing any pip libs!**

- [Upgrade pip](#upgrade-pip)
- [Check pip version](#check-pip-version)
- [Install a package](#install-a-package)
- [Install from requirements.txt](#install-from-requirementstxt)
- [Clear pip cache](#clear-pip-cache)
- [Resolve dependency conflicts](#resolve-dependency-conflicts)
- [List installed packages](#list-installed-packages)
- [Freeze installed packages into a file](#freeze-installed-packages-into-a-file)
- [Uninstall a package](#uninstall-a-package)
- [Allow breaking system packages](#allow-breaking-system-packages)
- [Downgrade pip or packages](#downgrade-pip-or-packages)
- [Install from GitHub](#install-from-github)
- [Check dependencies with pipdeptree](#check-dependencies-with-pipdeptree)
- [Autoremove unused packages](#autoremove-unused-packages)

---

## Virtual Environment Activate

#### Linux/macOS
```bash
python3 -m venv venv && source venv/bin/activate
```

#### Windows
```bash
python -m venv venv && .\venv\Scripts\activate
```

#### Common Error: "Virtual environment not activating"
Ensure you have the necessary permissions and correct Python version installed. On Linux/macOS, check the shell configuration:
```bash
chmod +x venv/bin/activate
source venv/bin/activate
```
On Windows:
```bash
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
```

---

![Windows](https://github.com/user-attachments/assets/9b7231bf-ab64-41de-819c-ead7f17f58b6)

---

#### `ModuleNotFoundError`
```bash
python -m pip install --upgrade --force-reinstall
```

#### `ERROR: Could not install packages due to an EnvironmentError`
```bash
pip install --user
```

#### `ERROR: Command errored out with exit status 1`
```bash
pip install --no-cache-dir
```

#### `ERROR: pip is configured with locations that require TLS/SSL`
```bash
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org
```

#### SSL Certificate Verification Error
```bash
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org
```

#### UnicodeDecodeError
```bash
set PYTHONUTF8=1
```

#### `error: Microsoft Visual C++ 14.0 or greater is required`
- Install [Build Tools for Visual Studio](https://visualstudio.microsoft.com/visual-cpp-build-tools/).

#### `pip freeze` not displaying packages
Ensure you are in the correct virtual environment:
```bash
pip list
pip freeze > requirements.txt
```

#### `break system packages error windows`
When encountering this error, explicitly allow breaking system packages:
```bash
pip install --break-system-packages
```

#### Downgrade pip or packages
If upgrading causes compatibility issues:
```bash
pip install pip==
```
```bash
pip install ==
```

---

![linux-macos](https://github.com/user-attachments/assets/6707e68e-0b44-4ecc-8ae8-7b34c159eae0)

---

#### `ModuleNotFoundError`
```bash
python3 -m pip install --upgrade --force-reinstall
```

#### `ERROR: Could not install packages due to an EnvironmentError`
```bash
pip install --user
```

#### `ERROR: Command errored out with exit status 1`
```bash
pip install --no-cache-dir
```

#### `ERROR: pip is configured with locations that require TLS/SSL`
```bash
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org
```

#### SSL Certificate Verification Error
```bash
pip install --trusted-host pypi.org --trusted-host files.pythonhosted.org
```

#### UnicodeDecodeError
```bash
export PYTHONUTF8=1
```

#### `fatal error: Python.h: No such file or directory`
```bash
sudo apt-get install python3-dev # Ubuntu/Debian
sudo yum install python3-devel # CentOS/Red Hat
```

#### `pip freeze` not displaying packages
Ensure you are in the correct virtual environment:
```bash
pip list
pip freeze > requirements.txt
```

#### `break system packages error linux`
When encountering this error, explicitly allow breaking system packages:
```bash
pip install --break-system-packages
```

---

![pip-tips](https://github.com/user-attachments/assets/dda60b27-239a-4fee-b440-9b349b77cadd)

---

#### Upgrade pip
```bash
python3 -m pip install --upgrade pip
```

#### Check pip version
```bash
pip --version
```

#### Install a package
```bash
pip install
```

#### Install from `requirements.txt`
```bash
pip install -r requirements.txt
```

#### Clear pip cache
```bash
pip cache purge
```

#### Resolve dependency conflicts
```bash
pip install --use-deprecated=legacy-resolver
```

#### List installed packages
```bash
pip list
```

#### Freeze installed packages into a file
```bash
pip freeze > requirements.txt
```

#### Uninstall a package
```bash
pip uninstall
```

#### Allow breaking system packages
```bash
pip install --break-system-packages
```

#### Downgrade pip or packages
```bash
pip install pip==
```
```bash
pip install ==
```

#### Install from GitHub
Install a package directly from a GitHub repository:
```bash
pip install git+https://github.com//.git
```

#### Check dependencies with pipdeptree
Generate a dependency tree to debug conflicts:
```bash
pip install pipdeptree
pipdeptree
```

#### Autoremove unused packages
Clean up unused dependencies:
```bash
pip install pip-autoremove
pip-autoremove
```

---

Feel free to contribute or open an issue if new errors arise!