Fix: ‘pip’ is not recognized as an internal or external command

Some users attempting to install Python packages via Command Prompt encounter the pip is not recognized as an internal or external command error. This issue persists even after installing the Python distribution and confirming Python is added to the PATH variable.

pip’ is not recognized as an internal or external command Fix

What is PIP?

pip is a recursive acronym for Pip Installs Packages. It serves as a package manager used to install and manage software packages written in Python. Many users rely on pip to install and maintain packages from the Python Package Index.

Recent Python versions include the `pip` tool by default, facilitating the easy installation and management of packages.

Our investigation into this issue, based on user reports and personal testing, revealed several common triggers for this error message:

  • PIP installation not added to system variables – To run Python commands from a CMD window, the path of your pip installation must be added to your PATH system variable. It should be added automatically if you install Python using the installation executable.
  • Incorrect PATH entry – Adding the PATH manually can lead to errors, such as extra spaces or the omission of a necessary semicolon, resulting in the error message.

If you are currently struggling with this error, which prevents the use of Python commands in CMD, the methods detailed in this article are confirmed to work by at least one user.

Method 1: Checking if PIP is added to your PATH variable

First, verify whether your PIP installation is part of your PATH variable. This can be quickly done with a command in CMD.

This will direct your next steps effectively, helping you avoid needless measures.

Note: If you already know whether the path of your PIP installation is in your PATH variable, skip to subsequent methods.

To check if the PIP installation is in your PATH variable, follow these steps:

  1. Press Windows key + R to open the Run dialog box. Type cmd and press Enter to open Command Prompt.
    Run dialog: cmd
  2. In the Command Prompt window, type echo %PATH% and press Enter. This command lists all locations in the PATH variable.
    Checking the PIP installation in the PATH variable
  3. Should you find a path resembling C:\Python**\Scripts (dependent on your installed Python version), then the installation path is in your PATH variable, and you can proceed to Method 4 to troubleshoot pip installation path issues.

Method 2: Adding PIP to the PATH environment variable using the Windows GUI

If confirmed that PIP is not specified in the PATH as an environment variable, and Python distribution is already installed, manual addition is required.

Once completed, you’ll be able to execute pip commands from a Command Prompt window.

  1. Press Windows key + R to open up a Run dialog box. Type sysdm.cpl and press Enter to access the System Properties window.
    Run dialog: sysdm.cpl
  2. In the System Properties window, navigate to the Advanced tab and click on Environment Variables.
    Visit the Advanced tab to access Environment Variables
  3. Within the Environment Variables window, locate System variables and select Path. With Path highlighted, click on Edit….
    Choose the Path entry under System variables and click Edit
  4. Use the Edit Environment Variable window to click New and add the path where the pip installation resides. The default location for Python 3.4 is C:\Python34\Scripts. (This may vary for you if you have different version)
    Adding the pip installation location
  5. After adding the path, open a new CMD window and attempt to install a Python package utilizing pip. The pip is not recognized as an internal or external command error should no longer appear.

Method 3: Adding PIP to the PATH environment variable using CMD

Setting the PIP path environment variable directly from a CMD window is a faster alternative. Although this can be a bit more daunting if you’re unfamiliar with terminal usage, it saves time.

Follow these instructions to adjust the pip path environment from a Command Prompt window:

  1. Press Windows key + R to summon the Run dialog box. Type cmd and press Enter to open Command Prompt.
    Run dialog: cmd
  2. In Command Prompt, execute the command below to add the PIP installation to the environment variable:
    setx PATH %PATH%;C:\Python37\Scripts

    Note: Remember, the command above assumes the default location for Python 3.7. Modify the path after ‘;‘ if you are using a different Python version or a custom installation directory.

  3. Determine if this method succeeded by installing a Python package that uses PIP from the same Command Prompt window. If the error persists, proceed to the next method.

Method 4: Opening a Python package without adding the pip variable

If adding pip to the PATH environment variable is not your preferred solution, or you’ve followed the previous methods and are still encountering the error, you can install a Python package from CMD using different commands.

The Short Method:

  1. Press Windows key + R to access a Run dialog box. Enter cmd and press Enter to open a Command Prompt Window.
    Run dialog: cmd
  2. Execute the following, substituting the placeholder with the name of your package:
    python -m pip install [packagename]

    Note: Replace [packagename] with the actual name of the package you wish to install.

The Long Method:

  1. Press Windows key + R to open the Run dialog. Type cmd and hit Enter to launch Command Prompt.
    Run dialog: cmd
  2. In the Command Prompt, use the following command to switch to the directory where your Python .whl file is located:
    cd C:\python installs

    Note: The directory named python installs in our example contained the Python installation packages. Adjust this command according to the directory housing your .whl file.

  3. To install the Python package using pip, run this command:
    c:\python37\scripts\pip.exe install [package].whl

    Note: Update the python installation location if needed, based on your version or custom installation path. Also, replace the [package] placeholder with the actual package name.

If you’re unable to install the Python package using CMD with these two methods, proceed to ensure that pip is included in your Python installation with the next method.

Method 5: Ensuring that pip is included in your Python installation

Before considering reinstalling Python entirely, verify whether pip is excluded from your Python installation. Some installers might leave out pip by default.

However, you can amend this by modifying the Python installation to include pip. The following steps will guide you:

  1. Open a Run dialog by pressing Windows key + R. Type appwiz.cpl and press Enter to launch Programs and Features.
    Run dialog: appwiz.cpl
  2. In Programs and Features, right-click on the Python installation and choose Change.
    Adjust the Python installation
  3. At the Modify Setup popup, click Modify.
    Select Modify to ensure pip is installed
  4. On the Optional Features page, ensure the pip option is checked, then click Next.
    Modify the Python installation to incorporate pip
  5. Press the Install button to apply changes to the Python installation.
    Modifying the Python installation
  6. After updating the Python installation, check if you can install a Python package with pip without encountering the pip is not recognized as an internal or external command error by utilizing a CMD window.

Method 6: Installing Python via the executable installer

If previous methods have been unsuccessful, reinstalling Python and its components may resolve the pip is not recognized as an internal or external command error.

Using the Python executable installer is the simplest approach. If you install it with the correct configuration, pip should also be installed.

  1. Initiate the Run dialog by pressing Windows key + R. Input appwiz.cpl and press Enter to enter Programs and Features.
    Run dialog: appwiz.cpl
  2. Scroll through Programs and Features to locate the Python installation. Upon finding it, right-click and select Uninstall. Follow the on-screen prompts to remove it. Restart your computer after uninstallation.
    Uninstalling Python from the system
  3. After rebooting, visit this link (here) and download the most recent Python executable installer suited to your OS architecture.
    Downloading the correct Python executable installer
  4. Run the installation and start by checking Add Python to PATH to ensure Python commands work in Command Prompt. Next, click on Customize installation.
    Ensure that Python is added to PATH and click on Customize installation
  5. In the following window, verify that the pip box is selected and proceed by clicking Next.
    Confirm that pip is selected under optional features
  6. Maintain the default settings and Advanced Options, then initiate the installation by clicking Install.
    Python installation process
  7. Restart your computer manually if it doesn’t automatically prompt you to.
  8. After your computer has restarted, try installing a Python package using a CMD window to check if the issue has been resolved.
  9. If the error still appears, open a CMD window and execute the following command:
    python -m ensurepip --default-pip
    

    Note: With certain Python versions, particularly 3.6, pip may not be part of the default installation. This command is one of the official fixes suggested in the documentation to resolve such issues.

ABOUT THE AUTHOR

Kevin Arrows


Kevin Arrows is a highly experienced and knowledgeable technology specialist with over a decade of industry experience. He holds a Microsoft Certified Technology Specialist (MCTS) certification and has a deep passion for staying up-to-date on the latest tech developments. Kevin has written extensively on a wide range of tech-related topics, showcasing his expertise and knowledge in areas such as software development, cybersecurity, and cloud computing. His contributions to the tech field have been widely recognized and respected by his peers, and he is highly regarded for his ability to explain complex technical concepts in a clear and concise manner.