Skip to content

๐Ÿ› ๏ธ | Pip errors fixes. Includes common fixes, error resolutions!

Notifications You must be signed in to change notification settings

zebbern/pip-error-fixes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

14 Commits
ย 
ย 

Repository files navigation

Python Status License

Linux|MacOS|Windows

Activate Virtual Environment Before Installing Pip Libs

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 โž  Windows



Pip Tips โž  Linux|MacOS|Windows


Virtual Environment Activate

Linux/macOS

python3 -m venv venv && source venv/bin/activate

Windows

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:

chmod +x venv/bin/activate
source venv/bin/activate

On Windows:

Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned

Windows


ModuleNotFoundError

python -m pip install --upgrade --force-reinstall <package_name>

ERROR: Could not install packages due to an EnvironmentError

pip install --user <package_name>

ERROR: Command errored out with exit status 1

pip install --no-cache-dir <package_name>

ERROR: pip is configured with locations that require TLS/SSL

pip install <package_name> --trusted-host pypi.org --trusted-host files.pythonhosted.org

SSL Certificate Verification Error

pip install <package_name> --trusted-host pypi.org --trusted-host files.pythonhosted.org

UnicodeDecodeError

set PYTHONUTF8=1

error: Microsoft Visual C++ 14.0 or greater is required

pip freeze not displaying packages

Ensure you are in the correct virtual environment:

pip list
pip freeze > requirements.txt

break system packages error windows

When encountering this error, explicitly allow breaking system packages:

pip install <package_name> --break-system-packages

Downgrade pip or packages

If upgrading causes compatibility issues:

pip install pip==<specific_version>
pip install <package_name>==<specific_version>

linux-macos


ModuleNotFoundError

python3 -m pip install --upgrade --force-reinstall <package_name>

ERROR: Could not install packages due to an EnvironmentError

pip install --user <package_name>

ERROR: Command errored out with exit status 1

pip install --no-cache-dir <package_name>

ERROR: pip is configured with locations that require TLS/SSL

pip install <package_name> --trusted-host pypi.org --trusted-host files.pythonhosted.org

SSL Certificate Verification Error

pip install <package_name> --trusted-host pypi.org --trusted-host files.pythonhosted.org

UnicodeDecodeError

export PYTHONUTF8=1

fatal error: Python.h: No such file or directory

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:

pip list
pip freeze > requirements.txt

break system packages error linux

When encountering this error, explicitly allow breaking system packages:

pip install <package_name> --break-system-packages

pip-tips


Upgrade pip

python3 -m pip install --upgrade pip

Check pip version

pip --version

Install a package

pip install <package_name>

Install from requirements.txt

pip install -r requirements.txt

Clear pip cache

pip cache purge

Resolve dependency conflicts

pip install <package_name> --use-deprecated=legacy-resolver

List installed packages

pip list

Freeze installed packages into a file

pip freeze > requirements.txt

Uninstall a package

pip uninstall <package_name>

Allow breaking system packages

pip install <package_name> --break-system-packages

Downgrade pip or packages

pip install pip==<specific_version>
pip install <package_name>==<specific_version>

Install from GitHub

Install a package directly from a GitHub repository:

pip install git+https://github.com/<user>/<repo>.git

Check dependencies with pipdeptree

Generate a dependency tree to debug conflicts:

pip install pipdeptree
pipdeptree

Autoremove unused packages

Clean up unused dependencies:

pip install pip-autoremove
pip-autoremove <package_name>

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