Documentation doesn't explain how to upgrade Python version
See original GitHub issueIs your feature request related to a problem? Please describe.
I have a pipenv for my project, using Python version X. I want to move my project to Python version X+1 (or X+0.1). The documentation does not explain how to do this. The obvious command, pipenv python --X+1, results in a state with a warnings.
Describe the solution you’d like
The documentation should have a section, “How to upgrade the Python version”. It should lay out the steps one must follow to upgrade the Python interpreter.
This section would fit well in a section after https://pipenv.pypa.io/en/latest/basics/#example-pipenv-upgrade-workflow. If there are more complicated details, they should perhaps be in a section under https://pipenv.pypa.io/en/latest/advanced/ .
Describe alternatives you’ve considered
Issue #2482 asserts that pipenv --python 3.6 should be enough to upgrade the Python version and the reference to the Python version in Pipfile and Pipfile.lock. However, the discussion makes it clear that this is not what happens, nor is it what the developers believe should happen.
It is not clear to me if it is enough to:
- Edit
Pipfile, changing old Python version X to X+1 - run
pipenv --pythonX+1
Should one have to run pipenv --rm? I am not sure.
Should one edit Pipfile.lock in addition to Pipfile? I am not sure.
Additional context
Observed when upgrading a Python 2.7 project to Python 3.8, on macOS 10.13.6 High Sierra. From the discussion, it seems the procedure to upgrade the Python version is general for all version upgrades.
$ pipenv --support
Pipenv version: '2020.8.13'
Pipenv location: '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/pipenv'
Python location: '/opt/local/Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8'
Python installations found:
3.8.7:/Users/myuserid/.local/share/virtualenvs/MyProject-QGqwYDDx/bin/python33.8.7:/Users/myuserid/.local/share/virtualenvs/MyProject-QGqwYDDx/bin/python3.83.8.7:/Users/myuserid/.local/share/virtualenvs/MyProject-QGqwYDDx/bin/python33.8.7:/Users/myuserid/.local/share/virtualenvs/MyProject-QGqwYDDx/bin/python3.83.8.7:/opt/local/bin/python3.83.7.9:/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin/python33.7.9:/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin/python3.7m3.7.9:/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin/python3.73.7.9:/opt/local/bin/python33.7.9:/opt/local/bin/python3.7m3.7.9:/opt/local/bin/python3.73.6.12:/opt/local/bin/python3.63.6.12:/opt/local/bin/python3.6m3.3.7:/opt/local/bin/python3.32.7.18:/opt/local/bin/python22.7.18:/opt/local/bin/python2.72.7.16:/usr/bin/python2.72.5.0:/usr/local/bin/python2.5
PEP 508 Information:
{'implementation_name': 'cpython',
'implementation_version': '3.8.7',
'os_name': 'posix',
'platform_machine': 'x86_64',
'platform_python_implementation': 'CPython',
'platform_release': '17.7.0',
'platform_system': 'Darwin',
'platform_version': 'Darwin Kernel Version 17.7.0: Fri Oct 30 13:34:27 PDT '
'2020; root:xnu-4570.71.82.8~1/RELEASE_X86_64',
'python_full_version': '3.8.7',
'python_version': '3.8',
'sys_platform': 'darwin'}
System environment variables:
TMPDIRXPC_FLAGSApple_PubSub_Socket_RenderTERMLANGSSH_AUTH_SOCKDISPLAYSECURITYSESSIONIDXPC_SERVICE_NAMETERM_PROGRAMTERM_PROGRAM_VERSIONTERM_SESSION_IDSHELLHOMELOGNAMEUSERPATHSHLVLPWDOLDPWDMANPATHEDITORDBUS_SESSION_BUS_ADDRESSPYTHONPATHDJANGO_SETTINGS_MODULEPERL_MB_OPTPERL_MM_OPTPGDATAWSSH_ENVSSH_AGENT_PID__CF_USER_TEXT_ENCODINGPIP_DISABLE_PIP_VERSION_CHECKPYTHONDONTWRITEBYTECODEPIP_PYTHON_PATHPIPENV_ACTIVEVIRTUAL_ENVPS1_PIP_SHIMS_BASE_MODULEPYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_ACTIVE:1
Debug–specific environment variables:
PATH:/Users/myuserid/.local/share/virtualenvs/MyProject-QGqwYDDx/bin:/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin:/Users/myuserid/bin/:/opt/local/bin:/opt/local/sbin:/opt/local/Library/Frameworks/Python.framework/Versions/Current/bin:/Users/myuserid/bin/:/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/Wireshark.app/Contents/MacOS:/opt/local/lib/postgresql94/bin/:/opt/local/lib/postgresql94/bin/SHELL:/bin/zshEDITOR:/usr/bin/picoLANG:en_CA.UTF-8PWD:/Users/myuserid/workspace/MyProject/srcVIRTUAL_ENV:/Users/myuserid/.local/share/virtualenvs/MyProject-QGqwYDDx
Contents of Pipfile (‘/Users/myuserid/workspace/MyProject/Pipfile’):
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true
[dev-packages]
[packages]
pytz = "*"
[requires]
python_version = "3.8"
Contents of Pipfile.lock (‘/Users/myuserid/workspace/MyProject/Pipfile.lock’):
{
"_meta": {
"hash": {
"sha256": "6bb63ee956e08f88ca14bbe22f144bc6378af47f14deb5139b778e3a321d4130"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.8"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"pytz": {
"hashes": [
"sha256:16962c5fb8db4a8f63a26646d8886e9d769b6c511543557bc84e9569fb9a9cb4",
"sha256:180befebb1927b16f6b57101720075a984c019ac16b1b7575673bea42c6c3da5"
],
"index": "pypi",
"version": "==2020.5"
}
},
"develop": {}
}
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:5

Top Related StackOverflow Question
@JDLH I know your offer to help with a PR improving the documentation is a little old by now, but if you are still interested in doing so I think it would be a reasonable improvement. Would be happy to try and help push it across the line.
Hi @matteius, are you still interested in this additional documentation? I’m looking to upgrade a project from Python 3.9 to 3.10 (to get structural pattern matching) so I was looking for the optimum/correct/developer specified way to do this, and I saw that the documentation is not there still.
Also, just as an observation, I downloaded the repo to have a look at the existing documentation — there are some challenges I see.