58

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:

Everyone, stop using pipenv. It's terrible. Use poetry instead.

adam.hendry
  • 4,458
  • 5
  • 24
  • 51
  • 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. – hlongmore Aug 15 '23 at 10:38

1 Answers1

84

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.

guerda
  • 23,388
  • 27
  • 97
  • 146
Evgeny
  • 4,173
  • 2
  • 19
  • 39
  • 24
    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. – user3748764 Feb 08 '19 at 15:49
  • 7
    ALso note that if you have installed numpy as a dev package you need to do `pipenv update numpy --dev` – Fabich Aug 11 '20 at 13:26
  • 2
    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). – Gino Mempin May 12 '21 at 02:47
  • 3
    you can use --selective-upgrade and potentially --keep-outdated flags for `pipenv install` – StriveForBest Sep 22 '21 at 21:48