Disable upgrades to existing python modules which were not installed via pip
See original GitHub issueWhat’s the problem this feature will solve?
pip lets me upgrade python modules installed by the system package manager
Describe the solution you’d like
pip should not touch packages not installed by it 😉
$ rpm -qf /usr/lib64/python2.7/site-packages/nacl
python2-pynacl-1.2.0-2.fc28.x86_64
$ pip freeze
cffi==1.11.5
ply==3.9
pycparser==2.14
PyNaCl==1.2.0
six==1.11.0
$ sudo pip install --upgrade pynacl
...
Successfully installed pycparser-2.18 pynacl-1.2.1
Alternative Solutions
🤔
Additional context
I initially posted it here. For starters, I have opened a PR to make pip_installed_by_pip()
function more generic so that it can be used by whoever implements this feature.
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (16 by maintainers)
Top Results From Across the Web
Upgrade package without upgrading dependencies using pip?
Upgrade package and all dependencies to latest version: pip install --upgrade --upgrade-strategy eager (default in old versions)
Read more >Installing, uninstalling, or upgrading Python modules using ...
Open a terminal window. To uninstall, or remove, a package use the command '$PIP uninstall <package-name>'. This example will remove the flask ...
Read more >preventing pip from removing system packages during upgrade
One way to fix this problem is to get pip to upgrade my local packages and ignore the system-installed ones (if possible). Can...
Read more >How to use pip (Install, update, uninstall packages) - nkmk note
Install pip · pip and pip2, pip3 · Details of installed package: pip show · List of installed packages: pip list , pip...
Read more >Using Python's pip to Manage Your Projects' Dependencies
Note: On some Linux (Unix) systems like Ubuntu, pip comes in a separate package called python3-pip , which you need to install with...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I agree with @dstufft that only touching files installed specifically by
pip
by default would be problematic, since it inhibits migrating to pip from other non-system installers.What I do like though is the notion of being able to configure
pip
to be more opinionated about what it’s willing to touch, and provide a reasonably helpful error message when refusing to modify things. That way a distro-providedpip
can ship with that configuration set, andpython3 -m pip --upgrade pip
will fail with guidance on what the user should do instead.I’m thinking along the lines of a
python-installers.toml
file that can appear alongside anypip.conf
with entries like:(Tangentially related: https://github.com/pypa/pip/pull/5424 is a proposal to provide a way to add an extra “wrapper” identifier to the User Agent info that pip sends to PyPI. If that ends up being pursued, then it may make sense to structure it so that the wrapper info also ends up in the INSTALLER file)
This is now covered by https://peps.python.org/pep-0668/.