Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pipenv install package with exact latest version

Tags:

python

pip

pipenv

When I run pipenv install requests it will add the following to Pipfile:

requests = "*"

But I want pipenv to add the latest package to Pipfile as a fixed (hard-coded) version that is exact or compatible:

requests = "=={latest_version}"
# or
requests = "~={latest_version}"

The problem with requests = "*", is that it causes pipenv to accidentally upgrade the package to the latest version (which might cause compatibility issues) when relocking (for example when installing a new package).

With node running npm install axios will add a fixed (compatible) version:

"axios": "^0.21.1" // compatible

Currently, I have to go to the https://pypi.org/project/requests/ to determine the latest version and then run pipenv install requests=={latest_version}. Further version updates are managed by dependabot.

like image 929
nezort11 Avatar asked Dec 09 '25 05:12

nezort11


2 Answers

You may try:

pipenv install requests~=1.2
like image 182
Billy Hunt Avatar answered Dec 10 '25 19:12

Billy Hunt


This isn't currently possible (as of writing this comment). You can upvote/check https://github.com/pypa/pipenv/issues/5531 to see the status of the issue.

like image 45
Joseph Lou Avatar answered Dec 10 '25 17:12

Joseph Lou