pip is not recognized – How to fix it?

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

If that looks familiar then you’ve come to the right place. I’m going to show you how to fix it. This is a common issue if you didn’t install Python properly. Note that you are not alone – experienced users can also run into this issue!

Python Installation

You will need a Python IDE (Integrated Development Environment). There are many different ones out there, so feel free to use any one of them. I’m going to use the vanilla Python IDE, and it can be found here: https://www.python.org/downloads/.

I highly recommend getting the 64-bit version of Python.

The 64-bit Python will allow you to use more RAM than the 32-bit version, kind of similar to Excel. Generally speaking, more RAM = more processing power.

If you are not sure, the ones in red box are the 64-bit version of Python. Pick one that suits your operating system.

Python installation files – 64bit

I’m installing the most recent version as of today (April 16, 2020), which is v3.8.2. Once you open up the installer, here’s what you’ll see.

Python installation wizard

You can just click on “Install Now”, which will install Python with all the default settings. But I like to install Python to a different folder, so I’ll go with Customize installation, feel free to skip this step if you like.

Make sure you check the “Add Python 3.8 to PATH” box, this will save you a lot of trouble down the road. However, if you missed it, that’s also fine, and we can fix that later. I intentionally omitted the checkbox on this step.

Click on Install, and wait for it to complete.

Python installation – successful window

Setup was successful – YAY! Well, you wish it was that simple. Now, your Python will work, but the setup isn’t complete, you’ll get an error when trying to install libraries. Let’s take a look at that next.

Library installation/setup

The easiest way to install 3rd party Python libraries is to use pip install, which should be already available to you from the standard Python installation.

Bring up a Command Prompt. Now if you are using a company laptop, chances are there are other user profiles on your laptop. So you want to run the Command Prompt as administer. This way you’ll have more flexibility with the pip install.

Run Cmd as admin

I’m going to install our favorite library – pandas. To do that, I just need to type pip install pandas in the Command Prompt, and then press enter.

Python pip is not recognized

So why is it telling me that “pip is not recognized” when I just installed it???

This is because we missed the “Add Python to PATH” checkbox during the Python installation stage. pip is a program written in Python, the computer doesn’t know yet where to find this pip program. So we have to tell the computer where to look.

Add PATH

Go to your Python installation folder. For me, it’s C:\Program Files\Python38. Your Python folder might be different if you used the default installation setup. The pip program is stored in C:\Program Files\Python38\Scripts

Python pip folder location

Copy the current folder location. Next, go to your Windows search bar, type “PATH”, the following window will pop up. Open it, and click on the “Edit the system environment variables”.

Then click on “Environment Variables”.

Under User variables, select “PATH”, then “Edit”. Then click on “New” to add a new environment variable.

Here we are going to add two new variables. One is Your Python installation folder, the other one is the folder that contains the pip program. In my case:

Adding new environment variables for Python and pip

Hit “Ok” a couple of times to save the changes. Now, you need to restart the Command Prompt to make sure the new environment variables get picked up. Now let’s re-run the command pip install pandas.

pip install pandas successful

It worked!

Library folder

But where did pandas get installed to? Go to your Python installation folder. Again, it’s C:\Program Files\Python38 for me. Then, go to Lib -> site-packages. You can find pandas here. In fact, the site-packages folder is the home for all the 3rd party libraries. This folder is likely to grow as you use Python more.

Python library installation folder

Let’s review…

  1. First of all, make sure you check Add Python to PATH box during installation.
  2. If you missed it, manually add the Python folder (and the Script folder) to PATH environment variable.
  3. And use pip install to get any 3rd party Python library.

Now you have Python, enjoy!