What is the purpose of "pip install --user ..."?
--
Music by Eric Matyas
https://www.soundimage.org
Track title: Beneath the City Looping
--
Chapters
00:00 Question
00:41 Accepted answer (Score 401)
01:06 Answer 2 (Score 45)
01:37 Answer 3 (Score 39)
02:05 Answer 4 (Score 31)
06:58 Thank you
--
Full question
https://stackoverflow.com/questions/4298...
Answer 1 links:
[this issue]: https://github.com/pypa/pip/issues/3352#...
[this answer]: https://stackoverflow.com/a/56948334/230...
Answer 2 links:
[site.USER_SITE]: https://docs.python.org/2/library/site.h...
Answer 3 links:
[User Installs]: https://pip.pypa.io/en/latest/user_guide...
[in the Python Packaging documentation]: https://packaging.python.org/tutorials/i...
[in the Python VENV docs]: https://docs.python.org/3/library/venv.h...
--
Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...
--
Tags
#python #python3x #pip #virtualenv
#avk47
ACCEPTED ANSWER
Score 462
pip defaults to installing Python packages to a system directory (such as /usr/local/lib/python3.4). This requires root access.
--user makes pip install packages in your home directory instead, which doesn't require any special privileges.
ANSWER 2
Score 61
Just a warning:
According to this issue, --user is currently not valid inside a virtual env's pip, since a user location doesn't really make sense for a virtual environment.
So do not use pip install --user some_pkg inside a virtual environment, otherwise, virtual environment's pip will be confused. See this answer for more details.
ANSWER 3
Score 40
--user installs in site.USER_SITE.
For my case, it was /Users/.../Library/Python/2.7/bin. So I have added that to my PATH (in ~/.bash_profile file):
export PATH=$PATH:/Users/.../Library/Python/2.7/bin
ANSWER 4
Score 30
Other answers mention site.USER_SITE as where Python packages get placed. If you're looking for binaries, these go in {site.USER_BASE}/bin.
If you want to add this directory to your shell's search path, use:
export PATH="${PATH}:$(python3 -c 'import site; print(site.USER_BASE)')/bin"