Last updated: Apr 10, 2024
Reading timeยท5 min
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.
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.
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:
python -c "import os, sys; print(os.path.dirname(sys.executable))" where python
For me, the path is the following.
C:\Users\YOUR_USER\AppData\Local\Programs\Python\Python310
Note that I have Python 3.10 installed, which is reflected in the PATH.
Scripts
directory that
is located in your Python3X folder. This is where the executable files are
located.For me, it is the following path.
C:\Users\YOUR_USER\AppData\Local\Programs\Python\Python310\Scripts
You might also have to restart your PC, but that's not always necessary.
Try issuing pip
commands after restating CMD.
pip --version pip install requests
If you still encounter issues, try to add Python to your PATH using the official installer.
Download the installer from the official python.org website.
If you have Python already installed, start the installer and click on "Modify".
You can leave the optional features ticked.
If that didn't work, your Python installation might be corrupted.
Start the installer again and click on "Uninstall".
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.
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.
pip --version pip install requests
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.
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
.
Your path might also look something like the following if you are on macOS.
/Library/Frameworks/Python.framework/Versions/3.10/bin
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.
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.
# ๐๏ธ 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"
You can use the gedit
command to edit your profile file.
sudo gedit ~/.bashrc sudo gedit ~/.bash_profile sudo gedit ~/.zshrc
Or the nano
command if you prefer to add the line in your terminal.
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.
~/.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.
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.
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.
pip --version
You can also upgrade your version of pip by running the installation command with the --force-reinstall option.
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
.
# ๐๏ธ On Linux or macOS python -m ensurepip --upgrade # ๐๏ธ Using python 3 python3 -m ensurepip --upgrade # ๐๏ธ On Windows py -m ensurepip --upgrade
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:
get-pip.py
file is downloaded and run the following command.# ๐๏ธ 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
.
curl
(if you have curl
installed).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