When performing

sudo pip3 install --user -U youtube-dl

I get 2 warnings:

1. WARNING: The directory '/home/mue/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.

2. WARNING: The script youtube-dl is installed in '/home/mue/.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.


Concering 1. How can I resolve this?

Concering 2. Do you recommend ideed adding this to path. If yes: What is the command?

  • 2
    Please run the following command and then copy and paste the result in your question: echo $PATH Thanks!
    – mchid
    Jul 29, 2019 at 23:30

1 Answer 1


When you run pip3 using the sudo command, the file that is installed is owned by root instead of your current user mue. The purpose of running pip or pip3 with --user is so that you don't have to use sudo when you install stuff.

First, you can run the following command to restore ownership to your current user:

sudo chown $USER:$USER $HOME/.local/bin/youtube-dl

Next, you can run the following command to properly update youtube-dl

pip3 install --user -U youtube-dl

Finally, if you do not get a warning about your path, you are done.

However, if you still get a warning that youtube-dl is not in your path, just log out and log back in to automatically fix this problem.

To explain, there is a conditional statement in the ~/.profile file that automatically adds ~/.local/bin to your PATH if and only if the path exists. Therefore, when you log out and log back in, it will automatically update your PATH to include your local directory.

  • 1
    If you run the echo command, make sure you use tee -a so that it will "append" to the file. If you mess up, you can always restore the original file using: cp ~/.profilebackup ~/.profile.
    – mchid
    Jul 29, 2019 at 23:16

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.