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 from user149341 on Stack Overflow
🌐
Luminous Men
luminousmen.com › post › why-use-pip-install-user
Why Use `pip install --user`?
According to the help documentation (pip install --help), it instructs pip to: --user Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on Windows.
Discussions

Why Use `pip install --user`?
Don't use it, use a venv More on reddit.com
🌐 r/programming
30
26
November 22, 2023
Should pip install --user install in a venv install to the global user path? - Packaging - Discussions on Python.org
I started wondering this when replying to pypa/pip#7438. The current behaviour is: $ pip install ... # A: installs to global, system path $ pip install --user ... # B: installs to global, user path (venv) $ pip install ... # C: installs to venv (venv) $ pip install --user ... More on discuss.python.org
🌐 discuss.python.org
1
December 5, 2019
pip install --user should check that the user's $PATH is correct
On Unix, pip install --user ... drops scripts into ~/.local/bin. Historically, this directory has not been on the default Debian/Ubuntu $PATH. This is hopefully on its way to being fixed (bash 4.3-... More on github.com
🌐 github.com
21
June 23, 2016
Avoiding the use of ``--user`` and ``.local`` for pip installations
Hi all, I’ve seen a lot of use of the .local directory in SWAN, mostly through pip --user, for user-installations. Indeed, it is mentioned in the SWAN help at https://github.com/swan-cern/help/blob/master/advanced/install_packages.md. Given that the .local directory is automatically added ... More on swan-community.web.cern.ch
🌐 swan-community.web.cern.ch
0
0
April 14, 2020
🌐
Medium
luminousmen.medium.com › why-use-pip-install-user-2df0259c8fb7
Why Use `pip install — user`? - Kirill Bobrov
December 3, 2024 - According to pip install --help, it instructs pip to: --user Install to the Python user install directory for your platform. Typically ~/.local/, or %APPDATA%\Python on Windows.
🌐
Python Packaging
packaging.python.org › tutorials › installing-packages
Installing Packages — Python Packaging User Guide
It’s recommended to write {sys.executable} rather than plain python in order to ensure that commands are run in the Python installation matching the currently running notebook (which may not be the same Python installation that the python command refers to). ... Due to the way most Linux distributions are handling the Python 3 migration, Linux users using the system Python without creating a virtual environment first should replace the python command in this tutorial with python3 and the python -m pip command with python3 -m pip --user.
🌐
Reddit
reddit.com › r/programming › why use `pip install --user`?
r/programming on Reddit: Why Use `pip install --user`?
November 22, 2023 - Pip doesn't require root privilege if using --user. I use it to install some software on a cluster, mainly dependencies for some neovim plugins
🌐
Python.org
discuss.python.org › packaging
Should pip install --user install in a venv install to the global user path? - Packaging - Discussions on Python.org
December 5, 2019 - I started wondering this when replying to pypa/pip#7438. The current behaviour is: $ pip install ... # A: installs to global, system path $ pip install --user ... # B: installs to global, user path (venv) $ pip install ... # C: installs to venv (venv) $ pip install --user ...
Find elsewhere
🌐
pip
pip.pypa.io › en › stable › user_guide
User Guide - pip documentation v26.0.1
C:\> py -m pip install --user SomePackage [...] Requirement already satisfied (use --upgrade to upgrade) C:\> py -m pip install --user --upgrade SomePackage [...] Requirement already up-to-date: SomePackage # force the install C:\> py -m pip install --user --ignore-installed SomePackage [...] Successfully installed SomePackage ... This is now covered in Repeatable Installs. ... This is now covered in Dependency Resolution. As noted previously, pip is a command line program.
🌐
pip
pip.pypa.io › en › stable › cli › pip_install
pip install - pip documentation v26.0.1
(See the Python documentation for site.USER_BASE for full details.) ... Install everything relative to this alternate root directory. ... Installation prefix where lib, bin and other top-level folders are placed. Note that the resulting installation may contain scripts and other resources which reference the Python interpreter of pip, and not that of --prefix.
🌐
Data Science for Everyone
matthew-brett.github.io › pydagogue › installing_on_debian.html
Using Pip on Debian / Ubuntu — pydagogue 0.2 documentation
The --user flag to pip install tells Pip to install packages in some specific directories within your home directory.
🌐
GitHub
github.com › pypa › pip › issues › 3813
pip install --user should check that the user's $PATH is correct · Issue #3813 · pypa/pip
June 23, 2016 - When pip install --user installs a script into ~/.local/bin (or the equivalent on other OSes, why not), then it should check the current os.environ["PATH"], and if this directory is not on the PATH, then it should print an explanatory message that warns the user and gives them some information on how to fix the problem.
Author   njsmith
🌐
SWAN Community
swan-community.web.cern.ch › feedback, proposals and new ideas
Avoiding the use of ``--user`` and ``.local`` for pip installations - Feedback, proposals and new ideas - SWAN Community
April 14, 2020 - Hi all, I’ve seen a lot of use of the .local directory in SWAN, mostly through pip --user, for user-installations. Indeed, it is mentioned in the SWAN help at https://github.com/swan-cern/help/blob/master/advanced/install_packages.md. Given that the .local directory is automatically added to the Python path for all subsequent Python executions (not just the one that you did the installation with), it is fair to say that doing user installations in this way has a global effect for the user.
🌐
Techgrind
techgrind.io › home › explain › what is the purpose of "pip install --user ..."?
What is the purpose of "pip install --user ..."? | Techgrind.io
January 3, 2025 - The pip install --user ... command is a convenient way to install Python packages in a user-specific directory without impacting global or system-wide installations. It’s especially useful when you lack admin privileges or want to avoid ...
🌐
GitHub
gist.github.com › saurabhshri › 46e4069164b87a708b39d947e4527298
Install and use pip in a local directory without root/sudo access. · GitHub
pip install virtualenv --user cd project1_folder source bin/activate virtualenv project1 pip install db=1.0.0 --user cd ../project2_folder virtualenv project2 source bin/activate pip install db=2.0.0 --user
🌐
Reddit
reddit.com › r/python › why use `pip install --user`?
Why Use `pip install --user`? : r/Python
November 22, 2023 - The article doesn’t mention that if you set the env variable PIP_USER=1, pip install will always default to the --user option, without giving the flag.
🌐
Super User
superuser.com › questions › 1235216 › user-specific-vs-all-machine-pip-install
linux - user-specific vs all-machine pip install - Super User
July 27, 2017 - When I pip install as just any user, things get installed specifically for me; but if I do it as root, they get installed for the entire system (e.g. in /usr/local/bin). How can I make this choice
🌐
Python Packaging
packaging.python.org › installing
Installing Packages - Python Packaging User Guide
July 5, 2023 - It’s recommended to write {sys.executable} rather than plain python in order to ensure that commands are run in the Python installation matching the currently running notebook (which may not be the same Python installation that the python command refers to). ... Due to the way most Linux distributions are handling the Python 3 migration, Linux users using the system Python without creating a virtual environment first should replace the python command in this tutorial with python3 and the python -m pip command with python3 -m pip --user.
🌐
GitHub
github.com › pypa › pip › issues › 1668
Default to --user · Issue #1668 · pypa/pip
March 21, 2014 - This causes people to instead run sudo pip install foo which globally installs to the system Python. This creates an issue where people are using pip to manage system level packages when they should likely be using the system package manager. So my intention is that pip should default to --user however there are a few sticking points with this:
Author   dstufft