-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Description
Issue description
When using --system
, if the system Python version isn't compatible with the python_version
specified in Pipfile
/ Pipfile.lock
, then Pipenv doesn't error (as I would have expected), but instead silently continues the install with the incompatible system Python version.
Expected result
For Pipenv never to silently install dependencies using an incompatible Python version, and instead emit an error if using --system
and the system Python isn't the right version.
Actual result
Pipenv ignores the incompatible Python version (doesn't emit an error), and proceeds with the install.
Steps to replicate
Create this Dockerfile
:
FROM python:3.13-slim
WORKDIR /testcase
COPY <<EOF Pipfile
[[source]]
url = "https://pypi.org/simple"
verify_ssl = true
name = "pypi"
[packages]
typing-extensions = "*"
[requires]
python_version = "3.12"
EOF
COPY <<EOF Pipfile.lock
{
"_meta": {
"hash": {
"sha256": "9661ed313a79ccb68c7dc4e639068f86ddd91e307ec2ed60498858d002e9b547"
},
"pipfile-spec": 6,
"requires": {
"python_version": "3.12"
},
"sources": [
{
"name": "pypi",
"url": "https://pypi.org/simple",
"verify_ssl": true
}
]
},
"default": {
"typing-extensions": {
"hashes": [
"sha256:a439e7c04b49fec3e5d3e2beaa21755cadbbdc391694e28ccdd36ca4a1408f8c",
"sha256:e6c81219bd689f51865d9e372991c540bda33a0379d5573cddb9a3a23f7caaef"
],
"index": "pypi",
"markers": "python_version >= '3.8'",
"version": "==4.13.2"
}
},
"develop": {}
}
EOF
RUN pip install pipenv==v2025.0.2
# This should abort with an error about incompatible system Python version, but doesn't.
RUN pipenv install --system --verbose
Then run it with:
docker build . --progress plain --no-cache
It will succeed, when the pipenv sync
command should have errored (since the base image uses Python 3.13, but yet python_version
in Pipfile
and Pipfile.lock
specifies Python 3.12).