pipenv: Upgrading a dependency with --selective-upgrade doesn't seem to work with 2018.6.25
Running using the latest release (2018.6.25), selective upgrades don’t appear to work as expected. (If I’m doing something wrong, please let me know 😃 )
This was originally filed as #2410 but was closed out because it was thought to have been fixed in the latest release.
/home/madams/.local/venvs/pipenv/bin/python -m ‘pipenv.help’
$ python -m pipenv.help output
Pipenv version: '2018.6.25'
Pipenv location: '/home/madams/.local/venvs/pipenv/local/lib/python2.7/site-packages/pipenv'
Python location: '/home/madams/.local/venvs/pipenv/bin/python'
Other Python installations in PATH:
-
2.7:/usr/bin/python2.7 -
2.7:/usr/bin/python2.7 -
3.6:/usr/bin/python3.6m -
3.6:/usr/bin/python3.6 -
2.7.15:/usr/bin/python -
2.7.15:/usr/bin/python2 -
3.6.5:/usr/bin/python3
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '0',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '4.15.0-23-generic',
'platform_system': 'Linux',
'platform_version': '#25-Ubuntu SMP Wed May 23 18:02:16 UTC 2018',
'python_full_version': '2.7.14',
'python_version': '2.7',
'sys_platform': 'linux2'}
System environment variables:
GOPATHPYPI_PASSWORDIM_CONFIG_PHASELESSQT4_IM_MODULEGJS_DEBUG_OUTPUTPROJECT_HOMELC_CTYPEWINDOWPATHXDG_CURRENT_DESKTOPXDG_SESSION_TYPETERM_PROGRAM_VERSIONQT_IM_MODULELOGNAMEUSERPATHXDG_VTNRHOMEVSCODE_IPC_HOOKVIRTUALENVWRAPPER_SCRIPTZSHDISPLAYXDG_SESSION_DESKTOPLANGTERMVIRTUALENVWRAPPER_WORKON_CDXAUTHORITYSESSION_MANAGERXDG_DATA_DIRSDEBFULLNAMEMANDATORY_PATHQT_ACCESSIBILITYGNOME_DESKTOP_SESSION_IDCLUTTER_IM_MODULETEXTDOMAINGNOME_TERMINAL_SERVICEEDITORXMODIFIERSGPG_AGENT_INFOVSCODE_NLS_CONFIGUSERNAMEWORKON_HOMEGTK_IM_MODULEVSCODE_CLIXDG_RUNTIME_DIRVIRTUALENVWRAPPER_PROJECT_FILENAMEELECTRON_NO_ATTACH_CONSOLESSH_AUTH_SOCKVTE_VERSIONGDMSESSIONKRB5CCNAMETEXTDOMAINDIRGNOME_SHELL_SESSION_MODESHELLPIP_PYTHON_PATHPYTHONDONTWRITEBYTECODETERM_PROGRAMXDG_SESSION_IDDBUS_SESSION_BUS_ADDRESS_DEFAULTS_PATHATOM_REPOS_HOMEDESKTOP_SESSIONLSCOLORSXDG_CONFIG_DIRSVIRTUALENVWRAPPER_HOOK_DIRVSCODE_NODE_CACHED_DATA_DIR_5546XDG_SEATVSCODE_NODE_CACHED_DATA_DIR_29546OLDPWDDEBEMAILGTK_MODULESSHLVLPWDPYPI_USERNAMECOLORTERMCHROME_DESKTOPGSM_SKIP_SSH_AGENT_WORKAROUNDXDG_MENU_PREFIXLS_COLORSPAGERGJS_DEBUG_TOPICSGNOME_TERMINAL_SCREEN
Pipenv–specific environment variables:
Debug–specific environment variables:
PATH:./node_modules/.bin:/home/madams/.cargo/bin:/usr/local/go/bin:./node_modules/.bin:/home/madams/.cargo/bin:/usr/local/go/bin:./node_modules/.bin:/home/madams/.cargo/bin:/usr/local/go/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/madams/dev/go/bin:/usr/lib/scala/bin:/home/madams/.rvm/bin:/opt/node/bin:/home/madams/.local/bin:/home/madams/dev/go/bin:/usr/lib/scala/bin:/home/madams/.rvm/bin:/opt/node/bin:/home/madams/.local/bin:/home/madams/dev/go/bin:/usr/lib/scala/bin:/home/madams/.rvm/bin:/opt/node/bin:/home/madams/.local/binSHELL:/usr/bin/zshEDITOR:vimLANG:en_US.UTF-8PWD:/home/madams/dev/pipenv-selective-upgrade-test
Contents of Pipfile (‘/home/madams/dev/pipenv-selective-upgrade-test/Pipfile’):
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[dev-packages]
[packages]
arrow = "*"
requests = "*"
[requires]
python_version = "3.6"
Contents of Pipfile.lock (‘/home/madams/dev/pipenv-selective-upgrade-test/Pipfile.lock’):
{
"_meta": {
"hash": {
"sha256": "0315ef9be6d34b575d5d8214db33cd0167cdd98c08b5a7b1fea08ed32ffe220f"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.6"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"arrow": {
"hashes": [
"sha256:c266f0db8f7aeb79764ce3c0aca6cb88978cfd27bfb9fb7588405b5ed331fd3e"
],
"index": "pypi",
"version": "==0.9.0"
},
"certifi": {
"hashes": [
"sha256:13e698f54293db9f89122b0581843a782ad0934a4fe0172d2a980ba77fc61bb7",
"sha256:9fa520c1bacfb634fa7af20a76bcbd3d5fb390481724c597da32c719a7dca4b0"
],
"version": "==2018.4.16"
},
"chardet": {
"hashes": [
"sha256:84ab92ed1c4d4f16916e05906b6b75a6c0fb5db821cc65e70cbd64a3e2a5eaae",
"sha256:fc323ffcaeaed0e0a02bf4d117757b98aed530d9ed4531e3e15460124c106691"
],
"version": "==3.0.4"
},
"idna": {
"hashes": [
"sha256:156a6814fb5ac1fc6850fb002e0852d56c0c8d2531923a51032d1b70760e186e",
"sha256:684a38a6f903c1d71d6d5fac066b58d7768af4de2b832e426ec79c30daa94a16"
],
"version": "==2.7"
},
"python-dateutil": {
"hashes": [
"sha256:1adb80e7a782c12e52ef9a8182bebeb73f1d7e24e374397af06fb4956c8dc5c0",
"sha256:e27001de32f627c22380a688bcc43ce83504a7bc5da472209b4c70f02829f0b8"
],
"version": "==2.7.3"
},
"requests": {
"hashes": [
"sha256:421cfc8d9dde7d6aff68196420afd86b88c65d77d8da9cf83f4ecad785d7b9d6",
"sha256:cc408268d0e21589bcc2b2c248e42932b8c4d112f499c12c92e99e2178a6134c"
],
"index": "pypi",
"version": "==2.19.0"
},
"six": {
"hashes": [
"sha256:70e8a77beed4562e7f14fe23a786b54f6296e34344c23bc42f07b15018ff98e9",
"sha256:832dc0e10feb1aa2c68dcc57dbb658f1c7e65b9b61af69048abc87a2db00a0eb"
],
"version": "==1.11.0"
},
"urllib3": {
"hashes": [
"sha256:a68ac5e15e76e7e5dd2b8f94007233e01effe3e50e8daddf69acfd81cb686baf",
"sha256:b5725a0bd4ba422ab0e66e89e030c806576753ea3ee08554382c14e685d117b5"
],
"version": "==1.23"
}
},
"develop": {}
}
Expected result
If I run pipenv install --selective-upgrade requests, I expect the lockfile to be updated to requests==2.19.1 and the new version to be installed in the virtualenv.
Actual result
The lockfile is not updated and the new version of requests is not installed.
Steps to replicate
- Clone https://github.com/mark-adams/pipenv-selective-upgrade-test
- Run
pipenv install - Run
pipenv install --selective-upgrade requests
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 26
- Comments: 38 (7 by maintainers)
Commits related to this issue
- Switch to a pip-tools workflow This is motivated by the issues around pipenv always upgrading every dependency whenever you touch any dependency. (See https://github.com/pypa/pipenv/issues/2665 and h... — committed to PeterJCLaw/srobo-runbook by PeterJCLaw 5 years ago
- Switch to a pip-tools workflow This is motivated by the issues around pipenv always upgrading every dependency whenever you touch any dependency. (See https://github.com/pypa/pipenv/issues/2665 and h... — committed to PeterJCLaw/srobo-runbook by PeterJCLaw 5 years ago
- Update dev dependencies to appease security warnings. Urllib3 had a security vulnerability, which was flagged by GitHub's security alerts. As this was a dependency of twine, a dev dependency, this di... — committed to hardlyknowem/declare_config by hardlyknowem 5 years ago
- Replace Pipenv with Poetry I used to use and like Pipenv but no longer think it’s viable - the project is in maintenance mode and has some serious unfixed issues ([link](https://github.com/pypa/pipen... — committed to TrashMonks/hagadias by syntaxaire 2 years ago
I’m having the same issue with v2018.7.1.
Actually I don’t get so far what is the recommended command to update a single package. Either
pipenv install --selective-upgrade requests, orpipenv update requests, as proposed here: example-pipenv-upgrade-workflowBoth ways do not work currently; they seem to update everything.
Hi @techalchemy, is there a fix for this available yet? Any way I can help?
You can use this workaround:
Pipfile.Pipfile.pipenv install, in which case thePipfile.lockfile will be updated to include this new version.Pipfile.I dug some in the
core.pyfile. The--selective-upgradeoption is only actually doing something when executingpipenv install. What happens here is that thedo_installfunction actually upgrades the package at hand. But then pipenv runs thedo_lockfunction without dealing with the fact that the package was just upgraded. So effectively,do_lockdowngrades the package back to its original version.The docs are just simply wrong right now on that you are supposed to be able to run
pipenv update <package>.@revolter pinning a version will not prevent other packages to be updated to the Pipfile.lock unless you pin them all, which is exactly what pipenv is supposed to fix in the first place 😛
This really really really need to be fixed.
One thing I’m unclear of regarding this bug report:
Is
pipenv install EXISTING_INSTALLED PACKAGEeven supposed to upgrade a package, rather than install itsPipenv.lock-specified version? The official docs at Example Pipenv Upgrade Workflow suggest you’re supposed to use theupdatecommand for that, and notinstall.I’m trying to debug the related issue mentioned above where installing a new package with
install --selective-upgrade PKGNAME, or upgrading an existing package withupdate --selective-upgrade PKGNAMEinsists on updating all packages.It’s hard to understand what’s the intended behavior is – there’s the
--selective-upgradeflag, which only modifies thepipcommand with--upgrade-strategy=only-if-needed(but doesn’t stop pipenv from trying to upgrade all packages), and the different--keep-outdatedwhich does other unclear things. The behavior of both flags are not clearly documented.As they are currently documented, it makes sense that if I run
pipenv installto install the packages as listed in thePipfile, then runningpipenv update --selective-upgrade --keep-outdatedshould do nothing (or even error). But it updates all the packages.This still does not work in pipenv
2020.11.15Soooo… Any progress on this? I updated Pipenv to 2018.11.26 (latest at the time of writing) and the workflow still doesn’t work…
I don’t expect this to ever work as expected, given how tangled up this code is. I moved on to poetry ages ago, primarily because of this.
Still an issue in pipenv
2020.11.15for me as well.After losing a bunch of time to pipenv today, here’s my workaround:
requests,25.2.1pipenv install --keep-outdated 'requests==25.2.1'will just update to that versiongit checkout -- Pipfileto revert to what you had before, in my caserequests = "*"This is the last major blocker for using Pipfile for us, and for many others I guess. Hence the high number of comments and level of energy here.
I know that the volunteer (thank you) maintainers are very busy, but just posting either about upstream requirements that are blocking this (maybe this needs a new feature in pip?), or giving a sketch of a solution (to allow people who are not experts to potentially help) would to a lot to alleviate things during the time while this issue stays open. At least if there was a sketch of a solution, I would look to see if there is a piece I could pick up.
Has anyone found any way to upgrade a single package? According to the docs, you are supposed to run
pipenv update <pkg>, however this updates all packages in myPipfile.lock. I’m on Windows 10, Python 3.7.1 and pipenv 2018.11.26 in a venv.For those who are adding new library but do not want to change the existing dependencies that are already in
Pipfile.lockthen just need to run the following command:pipenv install --keep-outdated <YOUR_LIBRAY>@techalchemy I tried removing the cache as you suggested but am still experiencing the issue. Do you get the same behavior when you clone my example repository?