In ubuntu 20.04, how to fix pip path?

I am using Ubuntu 20.04. Every time I try to install a package using pip I get a weird error.

pip3 install virtualenv
Collecting virtualenv Using cached virtualenv-20.0.21-py2.py3-none-any.whl (4.7 MB)
Requirement already satisfied: distlib<1,>=0.3.0 in ./.local/lib/python3.8/site-packages (from virtualenv) (0.3.0)
Requirement already satisfied: six<2,>=1.9.0 in /usr/lib/python3/dist-packages (from virtualenv) (1.14.0)
Requirement already satisfied: appdirs<2,>=1.4.3 in ./.local/lib/python3.8/site-packages (from virtualenv) (1.4.4)
Requirement already satisfied: filelock<4,>=3.0.0 in ./.local/lib/python3.8/site-packages (from virtualenv) (3.0.12)
Installing collected packages: virtualenv WARNING: The script virtualenv is installed in '/home/mark/.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 virtualenv-20.0.21

How can I fix this error, please help.

0

2 Answers

On Ubuntu 20.04 simply log out of your account and log back in to fix that warning. This will re-evaluate your ~/.profile, which in turn automatically adds the ~/.local/bin folder to your path if it exists (which it does now, but probably hasn't before your first run of pip3 install).

After logging back in, virtualenv should work as expected and later runs of pip3 should not raise that warning anymore.

3

My answer fixed the issue but shouldn't have been the right answer. If you happened to be here because you are currently facing the very same issue that OP met, please refer to Dreamer answer first (and comments)


virtualenv is not in your PATH for some reason (not properly installed ? I believe it should be in your /user/local/bin/ or /user/bin/, I see you didn't use sudo ?). You can add it to your PATH with

echo "export PATH=\"/home/mark/.local/bin:\$PATH\"" >> ~/.bashrc && source ~/.bashrc

Edit : pip3 install PKG --no-warn-script-location to use the flag to ignore the warning

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like