Skip to content

"Unimplemented comparison of constraints" error for platform_version dependency marker #9434

Closed
python-poetry/poetry-core
#722
@FeodorFitsner

Description

Description

Getting "Unimplemented comparison of constraints" error while trying to use platform_version marker in dependency.

Running:

% poetry install

Gives:

Installing dependencies from lock file

Unimplemented comparison of constraints

Dependency from pyproject.toml:

[tool.poetry.dependencies]
oauthlib = { version = "^3.2.2", markers = "platform_system == 'Darwin' and 'arm' not in platform_version" }

Workarounds

No workarounds.

Poetry Installation Method

install.python-poetry.org

Operating System

macOS 14.5 (23F79)

Poetry Version

1.8.3

Poetry Configuration

cache-dir = "/Users/user/Library/Caches/pypoetry"
experimental.system-git-client = false
installer.max-workers = null
installer.modern-installation = true
installer.no-binary = null
installer.parallel = true
keyring.enabled = true
solver.lazy-wheel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /Users/user/Library/Caches/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
warnings.export = true

Python Sysconfig

No response

Example pyproject.toml

[tool.poetry.dependencies]
oauthlib = { version = "^3.2.2", markers = "platform_system == 'Darwin' and 'arm' not in platform_version" }

Poetry Runtime Logs

Installing dependencies from lock file

Finding the necessary packages for the current system

  Stack trace:

  19  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/cleo/application.py:327 in run
       325│ 
       326│             try:
     → 327│                 exit_code = self._run(io)
       328│             except BrokenPipeError:
       329│                 # If we are piped to another process, it may close early and send a

  18  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/console/application.py:190 in _run
       188│         self._load_plugins(io)
       189│ 
     → 190│         exit_code: int = super()._run(io)
       191│         return exit_code
       192│ 

  17  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/cleo/application.py:431 in _run
       429│             io.input.interactive(interactive)
       430│ 
     → 431│         exit_code = self._run_command(command, io)
       432│         self._running_command = None
       433│ 

  16  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/cleo/application.py:473 in _run_command
       471│ 
       472│         if error is not None:
     → 473│             raise error
       474│ 
       475│         return terminate_event.exit_code

  15  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/cleo/application.py:457 in _run_command
       455│ 
       456│             if command_event.command_should_run():
     → 457│                 exit_code = command.run(io)
       458│             else:
       459│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  14  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/cleo/commands/base_command.py:117 in run
       115│         io.input.validate()
       116│ 
     → 117│         return self.execute(io) or 0
       118│ 
       119│     def merge_application_definition(self, merge_args: bool = True) -> None:

  13  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/cleo/commands/command.py:61 in execute
        59│ 
        60│         try:
     →  61│             return self.handle()
        62│         except KeyboardInterrupt:
        63│             return 1

  12  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/console/commands/install.py:153 in handle
       151│         self.installer.verbose(self.io.is_verbose())
       152│ 
     → 153│         return_code = self.installer.run()
       154│ 
       155│         if return_code != 0:

  11  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/installation/installer.py:104 in run
       102│             self.verbose(True)
       103│ 
     → 104│         return self._do_install()
       105│ 
       106│     def dry_run(self, dry_run: bool = True) -> Installer:

  10  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/installation/installer.py:301 in _do_install
       299│ 
       300│         with solver.use_environment(self._env):
     → 301│             ops = solver.solve(use_latest=self._whitelist).calculate_operations(
       302│                 with_uninstalls=self._requires_synchronization,
       303│                 synchronize=self._requires_synchronization,

   9  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/puzzle/solver.py:71 in solve
        69│         with self._progress(), self._provider.use_latest_for(use_latest or []):
        70│             start = time.time()
     →  71│             packages, depths = self._solve()
        72│             end = time.time()
        73│ 

   8  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/puzzle/solver.py:154 in _solve
       152│ 
       153│         try:
     → 154│             result = resolve_version(self._package, self._provider)
       155│ 
       156│             packages = result.packages

   7  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/mixology/__init__.py:18 in resolve_version
        16│     solver = VersionSolver(root, provider)
        17│ 
     →  18│     return solver.solve()
        19│ 

   6  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/mixology/version_solver.py:175 in solve
       173│             while next is not None:
       174│                 self._propagate(next)
     → 175│                 next = self._choose_package_version()
       176│ 
       177│             return self._result()

   5  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/mixology/version_solver.py:514 in _choose_package_version
       512│             package = locked
       513│ 
     → 514│         package = self._provider.complete_package(package)
       515│ 
       516│         conflict = False

   4  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/puzzle/provider.py:544 in complete_package
       542│                 continue
       543│ 
     → 544│             if self._env and not dep.marker.validate(self._env.marker_env):
       545│                 continue
       546│ 

   3  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/core/version/markers.py:649 in validate
        647│ 
        648│     def validate(self, environment: dict[str, Any] | None) -> bool:
     →  649│         return all(m.validate(environment) for m in self._markers)
        650│ 
        651│     def without_extras(self) -> BaseMarker:

   2  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/core/version/markers.py:649 in <genexpr>
        647│ 
        648│     def validate(self, environment: dict[str, Any] | None) -> bool:
     →  649│         return all(m.validate(environment) for m in self._markers)
        650│ 
        651│     def without_extras(self) -> BaseMarker:

   1  ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/core/version/markers.py:268 in validate
        266│         # to know that.
        267│         constraint = self._parser(environment[self._name])
     →  268│         return self._constraint.allows(constraint)  # type: ignore[arg-type]
        269│ 
        270│     def without_extras(self) -> BaseMarker:

  ValueError

  Unimplemented comparison of constraints

  at ~/Library/Application Support/pypoetry/venv/lib/python3.11/site-packages/poetry/core/constraints/generic/constraint.py:58 in allows
       54│         return self._operator
       55│ 
       56│     def allows(self, other: BaseConstraint) -> bool:
       57│         if not isinstance(other, Constraint):
    →  58│             raise ValueError("Unimplemented comparison of constraints")
       59│ 
       60│         is_equal_op = self._operator == "=="
       61│         is_non_equal_op = self._operator == "!="
       62│         is_other_equal_op = other.operator == "=="

Metadata

Assignees

No one assigned

    Labels

    area/coreRelated to the poetry-core librarykind/bugSomething isn't working as expected

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions