-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pipenv fails to parse platform-specific requirement in Pipfile when using a versioning scheme #6231
Comments
@OliverFarren could you re-check with latest pipenv? I was not able to reproduce this one ...
|
Analysis of Pipenv Issue #62311. Problem Summary: The issue describes a problem in Pipenv's parsing of package specifiers within the Pipfile when a versioning scheme (like "==0.4.*") and platform-specific markers are used together. This leads to an 2. Comment Analysis:
3. Proposed Resolution: The problem is likely caused by the order of operations when handling the
To resolve this, Pipenv should handle the 4. Code Snippet (pipenv/utils/dependencies.py): def install_req_from_pipfile(name, pipfile):
# ... (Existing Code) ...
# Combine version and markers before constructing the requirement string
version = pipfile.get("version", "").replace("==", "")
markers = pipfile.get("markers", "")
req_str = f"{name}{extras_str}{version}{markers}"
install_req, _ = expansive_install_req_from_line(
req_str,
# ... (Existing Arguments) ...
)
# ... (Rest of the code) ... 5. Additional Steps:
This fix should ensure that Pipenv correctly parses and processes package definitions with both versioning schemes and platform-specific markers, leading to a more robust locking process. |
@OliverFarren When you get a chance, could you check this issue report against #6276 Its a larger Pr than just this issue, but since I put a ton of work into refactoring the install routine methods and ensuring we actually don't do full lock resolution when installing packages, but I included a possible refactor based on the above analysis re-run through Claude, so its possible it won't work, too. The larger refactor was done by me, the human. |
Hey @matteius I had a look at the PR and it possibly addresses this issue? Looking at the verbose output stack trace above
I can see how this addition of the PR may be a positive change: pipenv/pipenv/utils/dependencies.py Lines 1135 to 1140 in c163030
Once the PR is merged and there's a new release, happy to update and try and reproduce |
Issue description
When installing a package with a platform specifier for windows whilst on mac, along with a package version like the following
i'm getting the following error
It feels like there's a parsing issue. If I wildcard the version it works fine and it appears the
==
has been stripped away. What's also weird to me though is that in the stdout output it clearly skips the dependency due to it being 'win32'.Non verbose output:
Verbose output
Steps to replicate
Add following to Pipfile
Install
$ pipenv --support
Pipenv version:
'2024.0.1'
Pipenv location:
'/usr/local/Cellar/pipenv/2024.0.1/libexec/lib/python3.12/site-packages/pipenv'
Python location:
'/usr/local/Cellar/pipenv/2024.0.1/libexec/bin/python'
OS Name:
'posix'
User pip version:
'24.0'
user Python installations found:
PEP 508 Information:
System environment variables:
__CFBundleIdentifier
PATH
SHELL
SECURITYSESSIONID
TERM
USER
COMMAND_MODE
TMPDIR
LaunchInstanceID
TERMINAL_EMULATOR
SSH_AUTH_SOCK
XPC_FLAGS
TERM_SESSION_ID
__CF_USER_TEXT_ENCODING
LOGNAME
LC_CTYPE
XPC_SERVICE_NAME
HOME
SHLVL
PWD
OLDPWD
PYENV_ROOT
PYENV_SHELL
ZSH
PAGER
LESS
LSCOLORS
LS_COLORS
PIP_DISABLE_PIP_VERSION_CHECK
PYTHONDONTWRITEBYTECODE
PIP_PYTHON_PATH
PIPENV_ACTIVE
VIRTUAL_ENV
VIRTUAL_ENV_PROMPT
PS1
_
PYTHONFINDER_IGNORE_UNSUPPORTED
Pipenv–specific environment variables:
PIPENV_ACTIVE
:1
Debug–specific environment variables:
PATH
:/Users/oliverfarren/.pyenv/versions/3.9.13/bin:/Users/oliverfarren/.pyenv/versions/3.6.0/bin:/Users/oliverfarren/.pyenv/versions/3.8.13/bin:/Users/oliverfarren/.pyenv/versions/3.11.1/bin:/Users/oliverfarren/.pyenv/versions/3.7.13/bin:/Users/oliverfarren/.pyenv/versions/3.6.15/bin:/Users/oliverfarren/.pyenv/versions/3.10.4/bin:/Users/oliverfarren/.pyenv/versions/3.8.5/bin:/Users/oliverfarren/.pyenv/versions/3.11.4/bin:/Users/oliverfarren/.pyenv/versions/3.8.10/bin:/Users/oliverfarren/.pyenv/versions/3.8.16/bin:/Users/oliverfarren/.pyenv/versions/3.7.16/bin:/Users/oliverfarren/.local/share/virtualenvs/pipfile-bug-h7gOS49K/bin:/Users/oliverfarren/.pyenv/shims:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/Library/TeX/texbin
SHELL
:/bin/zsh
PWD
:/Users/oliverfarren/Documents/repos/pipfile-bug
VIRTUAL_ENV
:/Users/oliverfarren/.local/share/virtualenvs/pipfile-bug-h7gOS49K
Contents of
Pipfile
('/Users/oliverfarren/Documents/repos/pipfile-bug/Pipfile'):Contents of
Pipfile.lock
('/Users/oliverfarren/Documents/repos/pipfile-bug/Pipfile.lock'):The text was updated successfully, but these errors were encountered: