pip3 on ubuntu 16.04 LTS for a user
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.
Questions:
Concering 1. How can I resolve this?
Concering 2. Do you recommend ideed adding this to path. If yes: What is the command?
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.