Zsh: Command Not Found: Pip

Zsh: Command Not Found: Pip – Common Causes and Fixes

Encountering the "zsh: command not found: pip" error can be a troubling stumbling block for many developers, signaling a disconnection between their shell environment and Python's package installer. This error is not just a matter of inconvenience but stands as a barrier to software development and deployment processes

By Snow Dream Studios
Home   /Blog  /Guide  /Zsh: Command Not Found: Pip – Common Causes and Fixes

Encountering the "zsh: command not found: pip" error can be a troubling stumbling block for many developers, signaling a disconnection between their shell environment and Python's package installer. 

This error is not just a matter of inconvenience but stands as a barrier to software development and deployment processes, highlighting the critical role of environment configuration and tool accessibility in the modern coding landscape. 

Resolving this issue is essential for maintaining efficient workflow and leveraging Python’s vast repository of packages effectively.

This article aims to guide through the resolution of the "zsh: command not found: pip" error, starting with an understanding of the error's root causes. 

Subsequently, it will delve into practical solutions, including installing pip correctly, updating pip to its latest version, and correcting the PATH or environment settings to ensure it is correctly recognized by the Z shell (zsh). 


Understanding the Error: zsh: command not found: pip

What Causes the Error

The "zsh: command not found: pip" error typically arises when the pip package manager is not installed, or it's not properly configured in the system's PATH. 

This issue is prevalent among users who have multiple Python versions installed, as pip should align with the corresponding Python version. 

For instance, pip3 is designated for Python 3, while pip generally refers to Python 2. 

Users may encounter this error if they attempt to use pip with Python 3 without specifying pip3.

When and Why It Occurs

This error commonly occurs in environments like macOS and Linux, where pip might not be installed by default with Python installations. 

Users often face this issue after installing Python 3, which does not automatically configure pip3 as the default package manager unless explicitly set. 

The error is also frequent in the Z shell (zsh) environment, particularly when using frameworks like oh-my-zsh, where users may mistakenly assume that pip is ready to use without verifying its installation and path settings. 

Adjusting the .zprofile or .bash_profile to include the correct alias and PATH settings can resolve the issue, ensuring that pip commands refer to the correct Python version and pip installation.

Method 1: Installing Pip Correctly

Checking Python Version

Before installing pip, it's crucial to determine which version of Python is installed on the system. This ensures compatibility and proper functioning of pip. Users can check their Python version by opening a terminal and typing:

python --version

or for Python 3 specifically:

python3 --version

Installing Pip for Python 3

If Python 3 is installed but pip is missing, users can install pip using the following steps. 

First, download the get-pip.py script:

curl -O https://bootstrap.pypa.io/get-pip.py


Then, execute the script with Python 3:

python3 get-pip.py


This command installs pip linked to Python 3, ensuring that pip3 commands will function as expected.

Verifying Pip Installation

After installation, it's important to verify that pip is correctly installed. 

Users can check the installed version of pip by running:

pip3 --version


This command displays the version of pip installed and confirms it is operational. 

If the output shows a pip version linked to Python 3, the installation has been successful.

Method 2: Updating Pip to the Latest Version

To ensure pip functions optimally with your Python installation, keeping it updated is crucial. 

This section covers the steps to update pip to its latest version, addressing potential version conflicts between pip and Python.

Using Python’s Built-in Update Command

For Python 3.4 or Later: If using Python 3.4 or later, execute the following command in your terminal:

python -m pip install --upgrade pip 


This command updates pip to the latest version available.

For Both Python 2 and Python 3 Installed:

In cases where both Python 2 and Python 3 are present on the system, it's important to update pip for each version separately to avoid conflicts. 

Use the commands:

For Python 3:

python3 -m pip install --upgrade pip


For Python 2:

python2 -m pip install --upgrade pip


This ensures that each Python version uses the correct pip version.

Permissions Errors in Linux:

If encountering permissions errors during the update process in Linux, prepend sudo to the command to grant administrative privileges:

sudo python -m pip install --upgrade pip

Troubleshooting Version Conflicts between Pip and Python

Checking pip Version: To verify which version of pip is currently in use, especially when both Python 2 and Python 3 are installed,

use the commands for Python 3 and 

pip3 -V 


for Python 2.

pip2 -V


This helps in identifying which pip version is linked to which Python version.

Resolving Conflicts:

If pip commands default to Python 2 instead of the intended Python 3 (or vice versa), consider creating an alias in your .aliases file or directly in your .zshrc or .bashrc file. For instance, to default pip commands to Python 3.

one might add:

alias pip="python3 -m pip" 


After adding the alias, ensure to source your .zshrc or .bashrc file or restart your terminal for the changes to take effect.

By following these steps, users can effectively manage and update pip, ensuring compatibility with their Python installations and avoiding common errors associated with version conflicts.

Method 3: Correcting the Path or Environment

When encountering the "zsh: command not found: pip" error, correcting the path or environment settings is a crucial step towards resolution.

This method involves adjusting the system's PATH to ensure that the terminal recognizes the correct installation of pip.

Follow these steps to adjust your environment effectively.

Setting Path for Pip

  1. Determine if both Python 2 and Python 3 are installed. Python 3 installations might not automatically set pip3 as the default package manager.
  2. Use the command pip3 -V to check if pip3 is installed. If a version is displayed, pip3 is available for use.
  3. For installations in the ~ directory, input nano .bash_profile and locate the PATH setting for the desired Python version. It might look like this: PATH="/Library/Frameworks/Python.framework/Versions/3.5/bin:${PATH}" export PATH.
  4. Copy the PATH settings and paste them into the .zshrc file using nano .zshrc. This ensures that the terminal recognizes the correct version of pip.

Editing .zshrc File

If unfamiliar with opening the configuration file, use 

vim ~/.zshrc or code ~/.zshrc


(or any preferred editor).

Add the following lines to integrate the Version Control System into your prompt:

autoload -Uz vcs_info precmd() { vcs_info }


To finalize the prompt setup, include these lines:

setopt PROMPT_SUBST PROMPT='%F{green}%*%f %F{blue}%~%f %F{red}${vcs_info_msg_0_}%f$ '


Save the changes and apply them by running source ~/.zshrc or restarting the terminal.

Reloading the Terminal

  1. Utilize source ~/.zshrc to reload the configuration without closing the terminal.
  2. Alternatively, the omz reload command offers a straightforward method to refresh the zsh configuration, effectively reloading the terminal and applying any changes made to the environment or PATH settings.

By following these steps, users can correct their path or environment settings to resolve the "zsh: command not found: pip" error. 

Adjusting the PATH and ensuring the terminal is aware of the correct pip installation are key to utilizing pip commands successfully.


Why do I receive a "zsh: command not found: pip" error message?

This error occurs when you attempt to use the Pip package manager from your terminal, and it indicates that the Zsh shell (your command line interpreter) is unable to locate the Python command. 

This issue is specific to the Zsh shell; if the message starts with "bash," it indicates you're using the Bash shell instead.

How can I resolve the "pip command not found" error?

Resolving this error involves a few clear steps. First, ensure that pip is indeed installed on your system. 

You might want to try using "pip3" instead of "pip" to see if that resolves the issue. If pip is not installed, you can install the "python3-pip" package, use the "ensurepip" module, install pip using the "get-pip.py" script, or install pip as a standalone zip application.

What should I do if I encounter a "zsh command not found: python" error on macOS?

This error typically surfaces for new macOS Python users and signifies that Python is not recognized as a shell command. 

To fix this, you should properly install Python and adjust your Mac's PATH to include Python. 

This ensures that attempts to run the Python interpreter in the terminal are successful.

Why doesn't the pip command work on my Mac?

If you're facing a "pip: command not found" error on your Mac, it's likely because the pip package manager, which is Python's package manager, is either not installed on your system or it is installed but hasn't been added to your system's PATH. 

This prevents the system from recognizing the 'pip' command.