The script is installed in 'c:\users..' which is not on PATH

avatar
Borislav Hadzhiev

Last updated: Apr 10, 2024
5 min

banner

# Table of Contents

  1. Windows: The script is installed in 'c:\users..' which is not on PATH
  2. Unix: The script pip is installed in '/usr/local/bin' which is not on PATH

If you got the error on Windows, follow the instructions in the first subheading.

If you got the error on macOS or Linux, click on the following subheading.

# Windows: The script is installed in 'c:\users..' which is not on PATH

The warning "The script is installed in 'X' which is not on PATH" occurs when you install a Python package without having the path to Python and pip in your user's PATH environment variable.

To resolve this, add the path to Python and pip in your user's PATH environment variable.

cmd
The script jsonschema.exe is installed in 'c:\users\bobbyhadz\appdata\local\programs\python\python310-32\Scripts' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

To add Python and pip to your user's PATH environment variable:

  1. Click on the Search bar and type "environment variables".
  2. Click on "Edit the system environment variables".

edit system environment variables

  1. Click on the "Environment Variables" button.

click environment variables

  1. In the "User variables for YOUR_USER" section, select the "Path" variable and click "Edit".

select user path click edit

  1. Click on "New" and then click "Browse".

click new browse

  1. You can use one of the following commands to check where your Python installation is located.
cmd
python -c "import os, sys; print(os.path.dirname(sys.executable))" where python

find python path

For me, the path is the following.

cmd
C:\Users\YOUR_USER\AppData\Local\Programs\Python\Python310

Note that I have Python 3.10 installed, which is reflected in the PATH.

  1. Add the path to Python and then add the path to the Scripts directory that is located in your Python3X folder. This is where the executable files are located.

For me, it is the following path.

cmd
C:\Users\YOUR_USER\AppData\Local\Programs\Python\Python310\Scripts

add scripts folder

  1. Once the two paths are added, confirm the changes by clicking on the "OK" button twice.

added python and pip to path

  1. Close your Command prompt application and then reopen it.
Note that you must restart your Command prompt shell for the changes to take effect.

You might also have to restart your PC, but that's not always necessary.

Try issuing pip commands after restating CMD.

cmd
pip --version pip install requests

If you still encounter issues, try to add Python to your PATH using the official installer.

  1. Download the installer from the official python.org website.

  2. If you have Python already installed, start the installer and click on "Modify".

click modify

You can leave the optional features ticked.

optional features

  1. On the "Advanced Options" screen, make sure to tick the "Add Python to environment variables" option.

add python to environment variables

  1. Once the "Add Python to environment variables" checkbox is checked, click "Install".
Now your Python installation should be set up correctly and Python should be added to your user's PATH environment variable.

If that didn't work, your Python installation might be corrupted.

Start the installer again and click on "Uninstall".

uninstall python

Now that you don't have Python installed on your machine, start the installer again and make sure to tick the "Add python.exe to PATH" option.

add python exe to path

The checkbox won't be checked by default.

Once the "Add python.exe to PATH" checkbox is checked, click on "Install Now".

After the installation, Python will be installed and configured properly.

cmd
pip --version pip install requests

# Unix: The script pip is installed in '/usr/local/bin' which is not on PATH

The "WARNING: The script pip is installed in '/usr/local/bin' which is not on PATH" is shown when Python is not added to your PATH environment variable.

To resolve the issue, edit your bash or zsh profile file and add the path to Python to your PATH environment variable.

shell
WARNING: The script pip3.10 is installed in '/usr/local/bin' which is not on PATH. Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location. Successfully installed pip-22.3.1 setuptools-56.0.0 WARNING: Running pip as root will break packages and permissions. You should install packages reliably by using venv: https://pip.pypa.io/warnings/venv

The warning message contains the path to the location you should add to your PATH environment variable.

In the example, the path is /usr/local/bin.

path to pip executable

Your path might also look something like the following if you are on macOS.

shell
/Library/Frameworks/Python.framework/Versions/3.10/bin
This is the path to the pip executable, so it will always be in a bin directory.

Make sure to use the path from your warning message if it differs from /usr/local/bin.

You have to add the following line toward the end of your ~/.bashrc, ~/.bash_profile or ~/.zshrc file.

shell
export PATH="/usr/local/bin:$PATH"

Make sure to update the path before :$PATH if your warning message shows a different path to your bin directory.

shell
# ๐Ÿ‘‡๏ธ Make sure to specify the correct path export PATH="/your/path/to/bin:$PATH" # ๐Ÿ‘‡๏ธ for example export PATH="/Library/Frameworks/Python.framework/Versions/3.10/bin:$PATH"

add path to python to path environment variable

You can use the gedit command to edit your profile file.

shell
sudo gedit ~/.bashrc sudo gedit ~/.bash_profile sudo gedit ~/.zshrc

Or the nano command if you prefer to add the line in your terminal.

shell
sudo nano ~/.bashrc sudo nano ~/.bash_profile sudo nano ~/.zshrc

If you don't have any of the specified files, check if you have a file named ~/.profile or create a ~/.bash_profile file.

Note that ~/.profile is not run if ~/.bash_profile or ~/.bash_login exists.

Once you add the export PATH line at the end of your profile file, use the source command to update your shell session.

shell
source ~/.bashrc source ~/.bash_profile source ~/.zshrc

You can also close and reopen your terminal to restart the shell session if the issue persists.

Use the echo $PATH command to verify that the path to your /usr/local/bin directory is contained in your PATH environment variable.

shell
echo $PATH

The paths are separated by a colon.

If you can't see the path in your PATH environment variable, try to restart your computer or server.

If you edit your ~/.profile file, you have to log out and log back in for the changes to take effect.

Try to run the pip --version command after you've made the necessary changes.

shell
pip --version

# Upgrade your version of pip

You can also upgrade your version of pip by running the installation command with the --force-reinstall option.

shell
python -m pip install pip --upgrade --force-reinstall python3 -m pip install pip --upgrade --force-reinstall py -m pip install pip --upgrade --force-reinstall

If the issue is not resolved, try running the following command to upgrade pip.

shell
# ๐Ÿ‘‡๏ธ On Linux or macOS python -m ensurepip --upgrade # ๐Ÿ‘‡๏ธ Using python 3 python3 -m ensurepip --upgrade # ๐Ÿ‘‡๏ธ On Windows py -m ensurepip --upgrade
The ensurepip package enables us to bootstrap the pip installer into an existing Python installation or virtual environment.

Alternatively, you can use the official get-pip script to install pip.

Download the script from https://bootstrap.pypa.io/get-pip.py by:

  1. Clicking on the link.
  2. Right-clicking and selecting "Save as" in your browser.
Open your terminal in the location where the get-pip.py file is downloaded and run the following command.
shell
# ๐Ÿ‘‡๏ธ On Linux or macOS python get-pip.py # ๐Ÿ‘‡๏ธ Using python 3 python3 get-pip.py # ๐Ÿ‘‡๏ธ On Windows py get-pip.py

The get-pip.py script uses bootstrapping logic to install pip.

You can also download the script using curl (if you have curl installed).
shell
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # ๐Ÿ‘‡๏ธ On Linux or macOS python get-pip.py --force-reinstall # ๐Ÿ‘‡๏ธ Using python 3 python3 get-pip.py --force-reinstall # ๐Ÿ‘‡๏ธ On Windows py get-pip.py --force-reinstall
I wrote a book in which I share everything I know about how to become a better, more efficient programmer.
book cover
You can use the search field on my Home Page to filter through all of my articles.

Copyright ยฉ 2024 Borislav Hadzhiev