Troubleshooting & Comparisons

How to Fix 'Pip Not Recognized' Error in Windows

Learn how to troubleshoot and resolve the 'pip not recognized' error in Windows step by step.

4 min read

Learn how to troubleshoot and resolve the commonly encountered “‘pip’ is not recognized as an internal or external command” error on Windows systems. This guide explains the probable causes and provides step-by-step solutions to fix the issue.

Symptom: 'pip' Not Recognized Error

When attempting to use the pip command in the Command Prompt on a Windows system, you might encounter the following error message:

'pip' is not recognized as an internal or external command, operable program, or batch file.

This error indicates that either the Python installation is not properly configured, or the pip command is unavailable.

Cause: Missing or Incorrect Paths

The primary reasons for encountering this error are:

  • Incorrect PATH Environment Variable: The directories containing Python and pip are not referenced in the system's PATH variable.
  • Pip Not Installed: The pip package manager may not be installed on your system.

Fix 1: Add Python to Environment Variables

Improper PATH configuration is often the root cause. Follow these steps to add Python and pip to your PATH environment variables:

prerequisites

  • Ensure Python is installed on your system.
  • Use a Python installation that includes pip.

steps

  1. Open Command Prompt.
  2. Verify Python is installed and note its location by running:
    bash
    where python
  3. Copy the directory path, excluding python.exe (e.g., C:\Python39).
  4. Open the Environment Variables editor:
    • Press the Windows key and search for "Environment Variables."
    • Click "Edit the system environment variables."
    • In the System Properties window, click "Environment Variables."
  5. Under "System Variables," locate and select the Path variable. Then click Edit.
  6. Add the following entries to the PATH:
    • The Python installation directory you copied earlier (e.g., C:\Python39).
    • The Scripts folder in the same directory (e.g., C:\Python39\Scripts).
  7. Click OK on all open dialogs to save changes.
  8. Close and reopen Command Prompt, then run:
    bash
    pip --version
    If the correct version is displayed, the issue is resolved.

Fix 2: Install pip Manually

If pip is missing, install it manually using these steps.

prerequisites

  • Python 3.x must be installed on your system.

steps

  1. Download the get-pip.py file:
    • Visit the official pip website and locate the download link for get-pip.py.
    • Save the file to a directory like Downloads.
  2. Open Command Prompt and navigate to the directory where you saved get-pip.py:
    bash
    cd %USERPROFILE%\Downloads
  3. Install pip by running:
    bash
    python get-pip.py
  4. Add pip to the PATH by following the steps in Fix 1 to include the Scripts folder.
  5. Verify the installation by running:
    bash
    pip --version

Verification

After completing the setup, confirm that pip is accessible.

Verify pip Installation

pip --version
# Example output:
# pip 21.2.4 from C:\Python39\lib\site-packages\pip (python 3.9)

If no error appears and the version number is displayed, pip is successfully installed and configured.

Common Pitfalls and Tips


FAQ

What is the cause of the “‘pip’ is not recognized” error?

This error appears when pip is either not installed on your system or not correctly added to the PATH environment variable.

How do I check if pip is installed?

Run pip --version in Command Prompt. If pip is installed, this command will display its version and install location.

How do I fix the issue if environment variables are correct but pip still cannot be found?

Ensure that pip was installed alongside Python. If it is missing, follow the manual installation steps provided in the article.

Should I use global pip installations or virtual environments?

For project-specific dependencies, it’s recommended to use a virtual environment. You can set one up using:

bash
python -m venv myenv

Then activate it with myenv\Scripts\activate before using pip.


Official reference: Python documentation.