-
Notifications
You must be signed in to change notification settings - Fork 3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an upgrade-all command #4551
Comments
it doesnt make sense to add an upgrade_all command until there is a curated package repository |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
https://github.com/nschloe/pipdate does something like a makeshift global upgrade. Be aware though that upgrading can break things. |
You're absolutely right, it can break things ! 👍 |
Here is my attempt of an "almost" robust solution - pipupgrade. Also handles packages that break change. |
As this ticket is blocked by the development of the dependency resolver (#988), I thought I would mention here that the team is looking for help from the community to move forward on that subject. We need to better understand the circumstances under which the new resolver fails, so are asking for pip users with complex dependencies to:
You can find more information and more detailed instructions here |
I think this issue can now progress |
Well said, now we need someone to actually progress things. Any volunteers? |
@uranusjr I volunteer, any tips on getting started? |
Basic workflow might be something like this: python -m venv venv
venv/bin/python -m pip list --format freeze | \
grep --invert-match "pkg-resources" | \
cut --delimiter "=" --fields 1 | \
xargs pip install --upgrade Note that this installs / upgrades all the packages of the virtual environment in one |
I would filter with the or would we let this up to the user, who can suply |
Hi, @JensTimmerman. I did not use the |
@Bengt got it! we'll leave the filtering up to the user! However, I'm not seeing the difference in practice, if the packages are not outdated, and not new dependencies of packages that are outdated, they don't need to be considered? If a package has a dependency that is outdated, the dependency will show up in the list of outdated packages right? Or am I missing something? |
@JensTimmerman I am not sure that I get what you are saying. However, an issue can arise if a current package depends on an outdated dependency: |
Seems like What scenario does the |
A few use cases which come to mind first for me are when learning or teaching Python, or a module for it, and wanting to experiment with or demonstrate a current version, not an outdated one; when starting a new project and wanting to build and test it using current modules, not outdated ones; or, as I often do, when using Python as a shell-like environment for getting quick answers that are impractical in a standard shell such as Bash. In my work, I do a great deal more tutoring of college or university students in mostly first-year programming courses than I do Python development, and I'm always wanting to teach what's current. (I always teach through reference to documentation, in order to instill the practice of looking stuff up, which means I'm always learning the latest version as I teach it.) When not tutoring, I'm often in a Python REPL or notebook, looking for a quick solution to a problem which is impractical by hand, such as algorithmically substituting colours in a large, generated stylesheet to create a dark-mode user style for a large website which lacks one. In other words, I typically use Python more like Inkscape than Xcode. For those of us who use Python primarily as an application in its own right, not as a means to produce one, |
You really should not use You'll also have issue the next time you run, Eg, It's really a great way to end up with a broken system. Makes sense for a virtualenv that's use interactive though 👍🏻 |
I'll leave it to the originator of this request to discuss why they'd use the proposed Meanwhile, every native macOS application which depends on Python either uses the macOS-provided Python or a Python runtime packaged within the app's own bundle (aside from a one-line AppleScript app I wrote, called "Jupyter QtConsole", and "/Applications/Python 3/IDLE", which is a symlink into /usr/local/…). I use (But again, I'm just one random who likes the idea, not the one who requested it. And sure, I'll put virtualenv on my list too, after I cover the courses for upcoming semester's new program and the packages relevant for those. It looks interesting.) |
Folks, let's keep the discussion about managing system packages separate from this request. That's a different problem related to interaction of lots of tools. It's being tackled separately, and there's likely going to be a PEP and a bunch of process changes in various communities to properly solve that problem. This feature request is purely a pip-specific feature, about "I have a bunch of packages in an environment, and I want to bump them to the current latest version". That's a different thing from "is pip supposed to manage packages in an environment". |
I made a new attempt at implementing a upgrade-all command. in #10491 |
This comment has been minimized.
This comment has been minimized.
FWIW, my Meta Package Manager project can emulate the missing
|
Until an pip list --outdated | grep -Ev "Package|^-" | awk '{print $1}'| while IFS= read -r line ; do pip install "$line" -U ; done |
I think there are enough shell scripts doing this already. The problem is that this might cause compatibility issues. But, I wonder if there is already a 'safe' way to do an upgrade all command by now? If we take the output of |
Hi, it seems the blocker is resolved, what's the current state of this feature? Are there any plans to implement it? |
#10491 seems to have stalled, and no-one else is working on it as far as I am aware. |
okay. when can this command be added? it has been 6 years |
Feel free to submit a pull request. |
#10491 is open for feedback |
Bump. |
Linux/macOS with
Windows with
jq, if not already installed: |
@utkonos It is better not to use pip list --format json | jq -r '.[].name' | xargs pip install -U
Code in PowerShell (quickly tested in Windows and Linux): python -m pip install -U (pip list --format json | ConvertFrom-Json | ForEach-Object { $_.name }) |
I have found this one useful as well for when a particular library lags behind or for any other reason needs to be skipped no matter what. |
This might not be the purpose of the discussion, but I started to use poetry as package manager and I am enjoying it a lot . Maybe a very google alternative to handle with pip limitations |
Yes, higher level environment managers like poetry (and rye, pdm, conda, uv, pip-tools, etc.) are better suited to doing an upgrade all. They can remove or downgrade transitive dependencies, because they have some understanding of what packages are required or requested by the user, whereas pip only understands what's in the environment now. Pip, alas, only focuses on installing, it doesn't try to manage the environment itself. Users with those needs should look at those packages (I'm personally following uv as it supports features like constraints that were not as simple in poetry). Or look at writing their own scripts that wraps pip commands. |
Ref: #59
Blocked by: #988
Moving the discussion of upgrade-the-world functionality to a separate issue. It doesn't make sense to start this discussion until there's a dependency resolver added.
The text was updated successfully, but these errors were encountered: