How to run --upgrade with pipenv?
Asked Answered
R

1

69

Running (say for numpy) pipenv install --upgrade numpy tries to install --upgrade and numpy instead of normal pip behavior for --upgrade switch.

Is anyone else having this problem?

Edit: I suggest using poetry instead of pipenv.

Rollie answered 20/6, 2018 at 1:35 Comment(1)
Regarding the edit: I used to say "Use pipenv if you are only including packages, and poetry if your are building libraries for others to use." But now, I'm squarely in the "use poetry instead camp". It supports multiple PyPI repos, which allows deliberately choosing to get packages from a private PyPI, while still allowing easy access to the default PyPI, and/or deliberately choosing to get just some packages from the default PyPI, or vice-versa with a private repo. Its version resolution is better. Its support of pyproject.toml is great; its lock file is more readable.Fussbudget
C
101

For pipenv use update command , not --upgrade switch. You can update a package with:

pipenv update numpy 

See comments in documentation.

This will also persist new version of package in Pipfile/Pipfile.lock, no manual editing needed. There was a bug with this command under certain scenarios, but hopefully it is fixed now.

Cantone answered 22/6, 2018 at 22:26 Comment(4)
Please note that pipenv update numpy will also try to update other, unrelated, packages (since it does a full lock in current version 2018.11.26). Those used to pip may be very surprised by that.Grooms
ALso note that if you have installed numpy as a dev package you need to do pipenv update numpy --devLightness
Also note that if the package is not in Pipfile, only in Pipfile.lock (because it's a dependency of another package in Pipfile), it will error out with "Warning: numpy was not found in your Pipfile! Aborting.". You will have to explicitly add it now to your Pipfile (making sure its version is still compatible with other packages).Clubby
you can use --selective-upgrade and potentially --keep-outdated flags for pipenv installSplenectomy

© 2022 - 2024 — McMap. All rights reserved.