×


PiP is not recognized as an internal or external command - Fix it Now ?

Sometimes, Windows users encounter the error, PiP is not recognized as an internal or external command when we try to install Python packages using a Command Prompt window.
Most affected users report that the issue occurs even after installing the Python distribution and making sure that Python is added to the path variable.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Python queries.
In this context, we shall look into how to resolve the error, PiP is not recognized as an internal or external command.

Nature of the error, PiP is not recognized as an internal or external command ?

Most users make use of PiP to install and manage Python packages found in the Python Package Index.
This error means that the Python is either not installed or the system variable path has not been set.
Some customers report that the issue occurs even after installing the Python distribution and making sure that Python is in the path variable.

The main causes of this error include:

1. PIP installation is not added to the system variable
In order to run Python commands from a CMD window, we need to add the path of PiP installation to our PATH in the system variable.
2. The installation is incorrectly added in our PATH
When we add the PATH manually, additional space or a missing semicolon before the new PATH will end up in the error.

How to fix the error, PiP is not recognized as an internal or external command ?

You can apply any of the below mentioned methods to resolve this error.

1. Check if PIP is added to our PATH variable
i. Type "cmd" in the Run prompt and press Enter.
ii. Inside the command prompt window, type echo %PATH% and press Enter to list all locations in the PATH variable.
iii. A path similar to C:\Python37\Scripts means that the installation path already exists in the PATH variable.

2. Add PIP to the PATH environment variable using the Windows GUI
i. Type "sysdm.cpl" in the Run prompt and press Enter.
ii. Inside the System Properties screen, go to Advanced tab >> Environment Variables.
iii. In there, go to System variables and click on Path to select it. Then click Edit…
iv. In the Edit environment variable screen, click on New and add the path where the PiP installation is located.
v. Once done, we open a fresh CMD window install a python package that comes with PiP.

3. Add PIP to the PATH environment variable using CMD
An easy way is to do it directly from a CMD window.
We follow the following steps to set the PiP path environment directly from a Command Prompt window:
i. Type "cmd" in the Run prompt and press Enter to open a Command Prompt window.
ii. Then, run the following command to set the PIP installation to the environment variable:

setx PATH "%PATH%;C:\Python37\Scripts"

In the command, we can change the Python version after ';' accordingly.

4. Open the Python package without adding the PiP variable
In order to do this, we can use a couple of different commands. This also works if we use the methods above to configure the environment PATH variable but still stuck with the error.
a. The Short Method:
i. Type "cmd" in the Run prompt and press Enter.
ii. Then type the following commands and make sure to change the placeholder to our own package name:

python -m pip install [packagename]


b. The Long Method:
i. Type "cmd" in the Run prompt and hit Enter.
ii. In the CMD window, use the following command to navigate to the directory where the python .whl file is.

cd C:\python installs

iii. Next, run the following command to install the Python package using pip:

c:\python37\scripts\pip.exe install [package].whl

We change the location of our python installation according to the version or if we install it in a custom location.
Also, make sure to change the [package] placeholder to our own package name.

5. Ensure that PiP is included in Python installation
Before reinstalling the whole Python environment, we need to check whether PiP was not omitted from the Python installation. Certain Python installers will leave PiP out of the default installation.
We can rectify this by modifying the Python installation and modifying it to install PIP.
Follow the steps given below:
i. Type "appwiz.cpl" in the Run prompt and press Enter to open Programs and Features.
ii. Then, right-click on the Python installation and click Change.
iii. At the Modify Setup screen, click on Modify.
iv. In the Optional Features screen, check the box associated with pip and click Next.
v. Then hit the Install button to make the changes to the Python installation.
Once done, open a CMD window and see if we are able to install a Python package with PiP without the error.

6. Install Python via the executable installer
Reinstalling Python along with its components will likely resolve this error.
The easiest way is to use the Python executable installer.

If we configure it correctly, it will automatically install PiP.
i. Type "appwiz.cpl" in the Run prompt and press Enter to open Programs and Features.
ii. Scroll down to find the Python installation. Once we find it, right-click and choose Uninstall, then follow the on-screen prompts to remove it from our system. Once done, restart the machine.
iii. At the next startup, visit the URL given below and download the latest Python executable installer according to our OS architecture.

https://www.python.org/downloads/windows/
iv. Open the installation executable and check the box near Add Python to PATH.

Then, click on Customize installation.
v. In the Optional Features window, make sure to check the box associated with pip, then click Next.
vi. Leave the default location and Advanced Options, then click Install to commence the installation.
vii. Once done, restart the computer manually.
viii. Then, try to install a Python package via a CMD window.
ix. If we are still seeing the error, type the following command in a CMD window:

python -m ensurepip --default-pip


[Couldn't solve this PIP error? We are here for you. ]


Conclusion

This article covers different methods to resolve PiP is not recognized as an internal or external command.

Basically, the error, "PiP is not recognized as an internal or external command" happens when we try to install Python packages via a Command Prompt window.
PiP is a recursive acronym for "Pip Installs Packages".

It's essentially a package management system used to install and manage software packages written in Python. Most users make use of PiP to install and manage Python packages found in the Python Package Index.

To add PIP to the PATH environment variable using the Windows GUI:

1. Press Windows key + R to open up a Run dialog box. Then, type "sysdm.cpl" and press Enter to open up the System Properties screen.
2. Inside the System Properties screen, go to the Advanced tab, then click on Environment Variables.
3. In the Environment Variables screen, go to System variables and click on Path to select it. Then with the Path selected, click the Edit… button.
4. In the Edit environment variable screen, click on New and add the path where the PiP installation is located. For Python 3.4, the default location is C:\Python34\Scripts.
5. Once the path is added, open a fresh CMD window and try to install a python package that comes with PiP.

You should no longer see the "pip is not recognized as an internal or external command" error.