Skip to content
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

Differences in behaviour of sync and install -r when ignoring dependencies due to environment mismatch #6099

Open
jdsalaro opened this issue Feb 24, 2024 · 0 comments

Comments

@jdsalaro
Copy link

Issue description

There are differences in behaviour when it comes to the dependencies which are ignored or installed whenever sync or install -r are used.

Assume a scenario where a user wishes to update a project written originally for an earlier Python version, 3.9, together with all its dependencies but the original Pipfile doesn't contain the exact versions pinned or is missing altogether. However, assume either the requirements.txt or the Pipfile.lock files are available.

Expected result

One would expect that the results of pipenv sync and pipenv install -r requirements.txt, in the later Python environment, are equivalent, but this is not the case.

In the case of a migration, say from Python 3.9 to 3.11, and when using pipenv sync, dependencies for which python_version marker mismatches are observed will be ignored.

However, in the same scenario, when using pipenv install -r the same dependencies will still be installed.

Actual result

requirements.txt

-i https://pypi.org/simple
tomli==2.0.1; python_version < '3.11'
typing-extensions==4.7.1; python_version < '3.10'
zipp==3.16.0; python_version < '3.10'
...
Installing collected packages: zipp, typing-extensions, tomli

Successfully installed tomli-�[1m2.0�[0m.�[1m1�[0m typing-extensions-�[1m4.7�[0m.�[1m1�[0m zipp-�[1m3.16�[0m.�[1m0�[0m
...

sync

{
    "_meta": {
        "hash": {
            "sha256": "6d18433f07ef40ac8e479c1972d2fd8a96f2fca453118ddd0e2c516642307a6f"
        },
        "pipfile-spec": 6,
        "requires": {
            "python_version": "3.9"
        },
        "sources": [
            {
                "name": "pypi",
                "url": "https://pypi.org/simple",
                "verify_ssl": true
            }
        ]
    },
    "default": {
        "tomli": {
            "hashes": [
                "sha256:939de3e7a6161af0c887ef91b7d41a53e7c5a1ca976325f429cb46ea9bc30ecc",
                "sha256:de526c12914f0c550d15924c62d72abc48d6fe7364aa87328337a31007fe8a4f"
            ],
            "markers": "python_version < '3.11'",
            "version": "==2.0.1"
        },
        "typing-extensions": {
            "hashes": [
                "sha256:440d5dd3af93b060174bf433bccd69b0babc3b15b1a8dca43789fd7f61514b36",
                "sha256:b75ddc264f0ba5615db7ba217daeb99701ad295353c45f9e95963337ceeeffb2"
            ],
            "markers": "python_version < '3.10'",
            "version": "==4.7.1"
        },
        "zipp": {
            "hashes": [
                "sha256:1876cb065531855bbe83b6c489dcf69ecc28f1068d8e95959fe8bbc77774c941",
                "sha256:5dadc3ad0a1f825fe42ce1bce0f2fc5a13af2e6b2d386af5b0ff295bc0a287d3"
            ],
            "markers": "python_version < '3.10'",
            "version": "==3.16.0"
        }
    },
    "develop": {}
}
...
Ignoring tomli: markers 'python_version < "3.11"' don't match your environment
Ignoring typing-extensions: markers 'python_version < "3.10"' don't match your environment
Ignoring zipp: markers 'python_version < "3.10"' don't match your environment
...

Steps to replicate

The Pipfile.lock and requirement.txt files together with pipenv installation logs discussed here can be found in this repository: https://gitlab.com/jdsalaro-group/public/pipenv-sync-install-requirements-differences


$ pipenv --support

Pipenv version: '2023.11.15'

Pipenv location: '/Users/user/.asdf/installs/python/3.11.0/lib/python3.11/site-packages/pipenv'

Python location: '/Users/user/.asdf/installs/python/3.11.0/bin/python3.11'

OS Name: 'posix'

User pip version: '23.3.1'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.11.0',
 'os_name': 'posix',
 'platform_machine': 'arm64',
 'platform_python_implementation': 'CPython',
 'platform_release': '23.3.0',
 'platform_system': 'Darwin',
 'platform_version': 'Darwin Kernel Version 23.3.0: Wed Dec 20 21:30:44 PST '
                     '2023; root:xnu-10002.81.5~7/RELEASE_ARM64_T6000',
 'python_full_version': '3.11.0',
 'python_version': '3.11',
 'sys_platform': 'darwin'}

System environment variables:

  • PATH
  • MANPATH
  • TERM_PROGRAM
  • SHELL
  • TERM
  • ASDF_DIR
  • TMPDIR
  • HOMEBREW_REPOSITORY
  • TERM_PROGRAM_VERSION
  • ASDF_DEFAULT_TOOL_VERSIONS_FILENAME
  • TERM_SESSION_ID
  • USER
  • COMMAND_MODE
  • SSH_AUTH_SOCK
  • __CF_USER_TEXT_ENCODING
  • LaunchInstanceID
  • __CFBundleIdentifier
  • PWD
  • ASDF_CONFIG_FILE
  • ITERM_PROFILE
  • XPC_FLAGS
  • XPC_SERVICE_NAME
  • COLORFGBG
  • HOME
  • SHLVL
  • LC_TERMINAL_VERSION
  • HOMEBREW_PREFIX
  • ASDF_DATA_DIR
  • ITERM_SESSION_ID
  • LOGNAME
  • LC_CTYPE
  • HOMEBREW_CELLAR
  • INFOPATH
  • LC_TERMINAL
  • SECURITYSESSIONID
  • COLORTERM
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /Users/user/.asdf/installs/python/3.11.0/bin:/Users/user/.asdf/installs/python/3.12.0/bin:/Users/user/.asdf/installs/python/3.9.18/bin:/Users/user/.asdf/installs/python/-h/bin:/Users/user/.asdf/installs/python/3.9.1/bin:/Users/user/.asdf/installs/python/3.10.0/bin:/Users/user/.asdf/plugins/python/shims:/Users/user/.asdf/installs/python/3.11.0/bin:/Users/user/.rd/bin:/Users/user/.asdf/shims:/opt/homebrew/opt/asdf/libexec/bin:/opt/homebrew/bin:/opt/homebrew/sbin:/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/Apple/usr/bin:/Library/TeX/texbin
  • SHELL: /bin/zsh
  • PWD: /tmp/pipenv-sync-install-requirements-differences

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant