install --root=... tries to remove previously globally installed version
See original GitHub issueI tried to do pip install --root=... some-wheel-file.whl, which failed with a permission error because it tried to uninstall a globally installed version(!) and I luckily didn’t run with root permissions.
If i had, pip would have fucked up my package-manager-controlled global install.
What should happen is the same as with --user: install all dependencies to --root, then check if the package itself is installed in --root, remove it if so, and (re)install it to there. Leave it alone if it’s installed elsewhere.
Related to #3029
I can circumvent it by doing --root=... --ignore-installed --no-deps, but that is a hack:
What it does is ignoring installed packages to make it not try to remove previously installed versions (which it shouldn’t do in the first place if those versions don’t live in the specified --root!), and then I make it not install dependencies so that i end up with only that package installed in my --root.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:9
- Comments:16 (6 by maintainers)

Top Related StackOverflow Question
hi, for my part, I use
pip --root=...to install packages in a folder that serves as a basis for building a live system, a bit like a virtualenv… these packages are not directly available with the package manager of my distribution.Seems the result is similar for
--prefix:pip shouldn’t look for installed packages in default paths (e.g., ~/.local/lib/python3.6/site-packages) at all.