Skip to content

SolverProblemError with multiple constraints and path dependencies #3639

Closed
python-poetry/poetry-core
#324

Description

@marecabo
  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Windows 10 1909 x64
  • Poetry version: 1.1.4
  • Python version: 3.8.7 amd64
  • Link of a Gist with the contents of your pyproject.toml file: (please see below)

Issue

First, thank you for your work on poetry!

When executing poetry install and having specified multiple constraints dependencies with path dependencies, the solver tries to install both versions despite mutually excluding python restrictions. The wheels mentioned in the pyproject.toml are from here.

pyproject.toml
[tool.poetry]
name = "fokr"
version = "0.1.0"
description = ""
authors = ["Your Name <you@example.com>"]

[tool.poetry.dependencies]
python = "^3.8"
pyproj = [
    {path = ".python/pyproj-2.6.0-cp38-cp38-win_amd64.whl", python = "~3.8", markers = "sys_platform == 'win32'"},
    {path = ".python/pyproj-3.0.0.post1-cp39-cp39-win_amd64.whl", python = "~3.9", markers = "sys_platform == 'win32'"},
]

[tool.poetry.dev-dependencies]

[build-system]
requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"
Console Output
Using virtualenv: D:\***\.venv
Updating dependencies
Resolving dependencies...
   1: fact: fokr is 0.1.0
   1: derived: fokr
   0: Duplicate dependencies for pyproj
   1: fact: fokr depends on pyproj (2.6.0 .python\pyproj-2.6.0-cp38-cp38-win_amd64.whl)
   1: fact: fokr depends on pyproj (3.0.0.post1 .python\pyproj-3.0.0.post1-cp39-cp39-win_amd64.whl)
   1: selecting fokr (0.1.0)
   1: derived: pyproj (3.0.0.post1 .python\pyproj-3.0.0.post1-cp39-cp39-win_amd64.whl)
   1: conflict: fokr depends on pyproj (2.6.0 .python\pyproj-2.6.0-cp38-cp38-win_amd64.whl)
   1: ! not pyproj (2.6.0 .python\pyproj-2.6.0-cp38-cp38-win_amd64.whl) is satisfied by pyproj (3.0.0.post1 .python\pyproj-3.0.0.post1-cp39-cp39-win_amd64.whl)
   1: ! which is caused by "fokr depends on pyproj (3.0.0.post1 .python\pyproj-3.0.0.post1-cp39-cp39-win_amd64.whl)"
   1: ! thus: version solving failed
   1: Version solving took 0.217 seconds.
   1: Tried 1 solutions.

  Stack trace:

  8  d:\***\.python\python\lib\site-packages\clikit\console_application.py:131 in run
      129│             parsed_args = resolved_command.args
      130│
    → 131│             status_code = command.handle(parsed_args, io)
      132│         except KeyboardInterrupt:
      133│             status_code = 1

  7  d:\***\.python\python\lib\site-packages\clikit\api\command\command.py:120 in handle
      118│     def handle(self, args, io):  # type: (Args, IO) -> int
      119│         try:
    → 120│             status_code = self._do_handle(args, io)
      121│         except KeyboardInterrupt:
      122│             if io.is_debug():

  6  d:\***\.python\python\lib\site-packages\clikit\api\command\command.py:171 in _do_handle
      169│         handler_method = self._config.handler_method
      170│
    → 171│         return getattr(handler, handler_method)(args, io, self)
      172│
      173│     def __repr__(self):  # type: () -> str

  5  d:\***\.python\python\lib\site-packages\cleo\commands\command.py:92 in wrap_handle
       90│         self._command = command
       91│
    →  92│         return self.handle()
       93│
       94│     def handle(self):  # type: () -> Optional[int]

  4  d:\***\.python\python\lib\site-packages\poetry\console\commands\install.py:71 in handle
       69│         self._installer.verbose(self._io.is_verbose())
       70│
    →  71│         return_code = self._installer.run()
       72│ 
       73│         if return_code != 0:

  3  d:\***\.python\python\lib\site-packages\poetry\installation\installer.py:103 in run
      101│         local_repo = Repository()
      102│
    → 103│         return self._do_install(local_repo)
      104│
      105│     def dry_run(self, dry_run=True):  # type: (bool) -> Installer

  2  d:\***\.python\python\lib\site-packages\poetry\installation\installer.py:235 in _do_install
      233│             )
      234│ 
    → 235│             ops = solver.solve(use_latest=self._whitelist)
      236│         else:
      237│             self._io.write_line("Installing dependencies from lock file")

  1  d:\***\.python\python\lib\site-packages\poetry\puzzle\solver.py:65 in solve
       63│         with self._provider.progress():
       64│             start = time.time()
    →  65│             packages, depths = self._solve(use_latest=use_latest)
       66│             end = time.time()
       67│

  SolverProblemError

  Because fokr depends on both pyproj (2.6.0 .python\pyproj-2.6.0-cp38-cp38-win_amd64.whl) and pyproj (3.0.0.post1 .python\pyproj-3.0.0.post1-cp39-cp39-win_amd64.whl), version solving failed.

  at d:\***\.python\python\lib\site-packages\poetry\puzzle\solver.py:241 in _solve
      237│             packages = result.packages
      238│         except OverrideNeeded as e:
      239│             return self.solve_in_compatibility_mode(e.overrides, use_latest=use_latest)
      240│         except SolveFailure as e:
    → 241│             raise SolverProblemError(e)
      242│
      243│         results = dict(
      244│             depth_first_search(
      245│                 PackageNode(self._package, packages), aggregate_package_nodes

Activity

  1. added
    kind/bugSomething isn't working as expected
    status/triageThis issue needs to be triaged
    on Feb 3, 2021
  2. kerryz commented on Mar 2, 2021

    @kerryz

    Getting the same problem with

    [tool.poetry.dependencies]
    torch = [
    	{version = "1.7.1", markers = "sys_platform == 'darwin'"},
    	{version = "1.7.1+cu110", markers = "sys_platform == 'linux' or sys_platform == 'win32'"}
    ]
    torchvision = [
    	{version = "0.8.2", markers = "sys_platform == 'darwin'"},
    	{version = "0.8.2+cu110", markers = "sys_platform == 'linux' or sys_platform == 'win32'"}
    ]
    
    [[tool.poetry.source]]
    name = "pytorch"
    url = "https://eternalphane.github.io/pytorch-pypi/"
    secondary = true
    

    CUDA isn't support for macOS, which is why I need to version like this.

  3. radoering commented on Apr 15, 2022

    @radoering
    Member

    The original issue seems to be a duplicate of #3444. The reason is explained in #4965.

    @kerryz The torch/torchvision issue is different. It may be related to local version identifiers (see #2543 and #4231). It may be resolved in 1.2.0b1.

  4. github-actions commented on Mar 1, 2024

    @github-actions

    This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

  5. locked as resolved and limited conversation to collaborators on Mar 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/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