pipenv icon indicating copy to clipboard operation
pipenv copied to clipboard

ERROR: No matching distribution found for XXX (where XXX should be excluded by sys_platform)

Open bearsh opened this issue 7 months ago • 4 comments

Issue description

Pipenv fails to lock Pipfile.lock if Pipfile contains entries where sys_platform does not match.

Expected result

Locking should work like it did previous releases

Actual result

pipenv install
Pipfile.lock (e50a6e) out of date, updating to (dcc263)...
Locking [packages] dependencies...
Building requirements...
Resolving dependencies...
✘ Locking Failed!
⠧ Locking...False
CRITICAL:pipenv.patched.pip._internal.resolution.resolvelib.factory:Could not find a version that satisfies the requirement pywin32 (from versions: none)
[ResolutionFailure]:   File "/home/bearsh/.local/pipx/venvs/pipenv/lib/python3.10/site-packages/pipenv/resolver.py", line 645, in _main
[ResolutionFailure]:       resolve_packages(
[ResolutionFailure]:   File "/home/bearsh/.local/pipx/venvs/pipenv/lib/python3.10/site-packages/pipenv/resolver.py", line 612, in resolve_packages
[ResolutionFailure]:       results, resolver = resolve(
[ResolutionFailure]:   File "/home/bearsh/.local/pipx/venvs/pipenv/lib/python3.10/site-packages/pipenv/resolver.py", line 592, in resolve
[ResolutionFailure]:       return resolve_deps(
[ResolutionFailure]:   File "/home/bearsh/.local/pipx/venvs/pipenv/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 908, in resolve_deps
[ResolutionFailure]:       results, hashes, internal_resolver = actually_resolve_deps(
[ResolutionFailure]:   File "/home/bearsh/.local/pipx/venvs/pipenv/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 681, in actually_resolve_deps
[ResolutionFailure]:       resolver.resolve()
[ResolutionFailure]:   File "/home/bearsh/.local/pipx/venvs/pipenv/lib/python3.10/site-packages/pipenv/utils/resolver.py", line 442, in resolve
[ResolutionFailure]:       raise ResolutionFailure(message=str(e))
[pipenv.exceptions.ResolutionFailure]: Warning: Your dependencies could not be resolved. You likely have a mismatch in your sub-dependencies.
  You can use $ pipenv run pip install <requirement_name> to bypass this mechanism, then run $ pipenv graph to inspect the versions actually installed in the virtualenv.
  Hint: try $ pipenv lock --pre if it is a pre-release dependency.
ERROR: No matching distribution found for pywin32

Steps to replicate

Pipfile:

[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]
nuitka = ">=1.0"
zstandard = "*"
mypy = "*"
ordered-set = "*"

[packages]
hidapi = "==0.*"
pyside6 = ">=6.1.2"
pywin32 = {version = "*", sys_platform = "== 'win32'"}
sqlalchemy = "~=1.3"
psycopg2-binary = "*"
python-box = ">=6,<7"
pip = ">=22.2"

$ pipenv --support

Pipenv version: '2023.11.15'

Pipenv location: '/home/bearsh/.local/pipx/venvs/pipenv/lib/python3.10/site-packages/pipenv'

Python location: '/home/bearsh/.local/pipx/venvs/pipenv/bin/python'

OS Name: 'posix'

User pip version: '23.3.1'

user Python installations found:

PEP 508 Information:

{'implementation_name': 'cpython',
 'implementation_version': '3.10.12',
 'os_name': 'posix',
 'platform_machine': 'x86_64',
 'platform_python_implementation': 'CPython',
 'platform_release': '6.5.0-1008-oem',
 'platform_system': 'Linux',
 'platform_version': '#8-Ubuntu SMP PREEMPT_DYNAMIC Fri Nov 10 13:08:33 UTC '
                     '2023',
 'python_full_version': '3.10.12',
 'python_version': '3.10',
 'sys_platform': 'linux'}

System environment variables:

  • SHELL
  • SESSION_MANAGER
  • WINDOWID
  • QT_ACCESSIBILITY
  • COLORTERM
  • XDG_CONFIG_DIRS
  • XDG_SESSION_PATH
  • LANGUAGE
  • LC_ADDRESS
  • LC_NAME
  • SSH_AUTH_SOCK
  • GOPRIVATE
  • SHELL_SESSION_ID
  • DESKTOP_SESSION
  • LC_MONETARY
  • SSH_AGENT_PID
  • GTK_RC_FILES
  • XCURSOR_SIZE
  • KDE_FORK_SLAVES
  • DBUS_STARTER_BUS_TYPE
  • XDG_SEAT
  • PWD
  • XDG_SESSION_DESKTOP
  • LOGNAME
  • XDG_SESSION_TYPE
  • SYSTEMD_EXEC_PID
  • XAUTHORITY
  • XKB_DEFAULT_MODEL
  • VIRTUALENVWRAPPER_SCRIPT
  • GTK2_RC_FILES
  • HOME
  • LC_PAPER
  • LANG
  • LS_COLORS
  • _VIRTUALENVWRAPPER_API
  • XDG_CURRENT_DESKTOP
  • KONSOLE_DBUS_SERVICE
  • WAYLAND_DISPLAY
  • QT_EXCLUDE_GENERIC_BEARER
  • KONSOLE_DBUS_SESSION
  • PROFILEHOME
  • XDG_SEAT_PATH
  • INVOCATION_ID
  • KONSOLE_VERSION
  • MANAGERPID
  • KDE_SESSION_UID
  • WORKON_HOME
  • XKB_DEFAULT_LAYOUT
  • LESSCLOSE
  • XDG_SESSION_CLASS
  • TERM
  • LC_IDENTIFICATION
  • LESSOPEN
  • USER
  • COLORFGBG
  • PLASMA_USE_QT_SCALING
  • KDE_SESSION_VERSION
  • PAM_KWALLET5_LOGIN
  • QT_WAYLAND_FORCE_DPI
  • DISPLAY
  • SHLVL
  • LC_TELEPHONE
  • MOZ_USE_XINPUT2
  • LC_MEASUREMENT
  • XDG_VTNR
  • XDG_SESSION_ID
  • DBUS_STARTER_ADDRESS
  • XDG_RUNTIME_DIR
  • LC_TIME
  • QT_AUTO_SCREEN_SCALE_FACTOR
  • JOURNAL_STREAM
  • XCURSOR_THEME
  • XDG_DATA_DIRS
  • KDE_FULL_SESSION
  • PATH
  • DBUS_SESSION_BUS_ADDRESS
  • KDE_APPLICATIONS_AS_SCOPE
  • LC_NUMERIC
  • _
  • OLDPWD
  • PIP_DISABLE_PIP_VERSION_CHECK
  • PYTHONDONTWRITEBYTECODE
  • PYTHONFINDER_IGNORE_UNSUPPORTED

Pipenv–specific environment variables:

Debug–specific environment variables:

  • PATH: /home/bearsh/opt/flutter/bin:/home/bearsh/go/bin:/home/bearsh/.npm/bin:/home/bearsh/.local/bin:/home/bearsh/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin
  • SHELL: /bin/bash
  • LANG: de_CH.UTF-8
  • PWD: /home/bearsh/tmp/flex-prodtool

bearsh avatar Nov 29 '23 08:11 bearsh

There was a change when we dropped requirementslib to try and make sys_platform locking include sub-dependencies, but if you want it to be truly skipped you can convert it to a marker -- for example: pywin32 = {version = "*", sys_platform = "== 'win32'"} --> pywin32 = {version = "*", markers = "sys_platform== 'win32'"}

Sorry for the trouble!

matteius avatar Dec 01 '23 03:12 matteius

thanks @matteius, that seems to work.

maybe the doc should be updated to reflex that change...

bearsh avatar Dec 01 '23 08:12 bearsh

Hello @matteius ,

When converting sys_platform to a marker, it solved the error when it had to be excluded (e.g. macOS, linux). But, it introduces an error when it has to be included (running Windows).

When using pywin32 = {version = "*", sys_platform = "== 'win32'"} on Windows, it works just fine.

When using pywin32 = {version = "*", markers = "sys_platform == 'win32'"} on Windows Server 2022, it gives me:

[pipenv.exceptions.InstallError]: ERROR: Could not find a version that satisfies the requirement pywin32== (from versions: 302, 303, 304, 305, 306)
[pipenv.exceptions.InstallError]: ERROR: No matching distribution found for pywin32==
ERROR: Couldn't install package: {}

Any hint to solve this issue on linux without introducing an error on Windows?

Thank you!

cetinajero avatar Mar 21 '24 14:03 cetinajero

Problem solved

To solve this on all platforms, I was forced to specify some version rather than *.

i.e.: pywin32 = {version = ">=306", markers = "sys_platform == 'win32'"}

With this, the Pipfile.lock file included the following snippet:

"pywin32": {
    "markers": "platform_system == 'Windows'",
    "version": "==306"
},

It seems that the "version": "==306" was needed on Windows to successfully install pywin32

cetinajero avatar Mar 21 '24 17:03 cetinajero