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

Petry version solving failed because apparently ignoring markers = "sys_platform == 'darwin'" #8135

Closed
6 tasks done
charEtoile opened this issue Jun 26, 2023 · 9 comments
Closed
6 tasks done
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@charEtoile
Copy link

charEtoile commented Jun 26, 2023

  • Poetry version: 1.4.2
  • Python version: 3.9.16
  • OS version and name: Ubuntu 20.04.6 LTS
  • pyproject.toml:

SimpleITK = [ { version = "<2.1.0", markers = "sys_platform == 'linux'" }, { version = "2.2.1", markers = "sys_platform == 'darwin'" } ]

Issue

I have the following error when poetry does the dependency resolution:

Because the_app depends on the_dep (0.1.7) which depends on simpleitk (<2.1.0), simpleitk is required.
So, because the_app depends on SimpleITK (2.2.1), version solving failed.

Why isn't Poetry seing the sys_platform == 'linux' marker ?

Thanks again 🙌

@charEtoile charEtoile added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 26, 2023
@dimbleby
Copy link
Contributor

dimbleby commented Jun 26, 2023

what you have given as your pyproject.toml

  • solves fine
  • bears little relation to the rest of the bug report (what is the_app and the_dep?)

please provide an actual repro

@charEtoile
Copy link
Author

charEtoile commented Jun 26, 2023

I don't have a public repo for this.

For sake of simplicity, I had renamed my main application the_app which depends on the-dep. You are right, when trying this issue on two simple almost empty projects, it works fine:

deleteme_main ===depends on===> deleteme_dep ===depends on===> (SimpleITK <2.1.0 on linux or 2.2.1 on darwin).

[tool.poetry]
name = "deleteme_dep"
version = "1.0.0"
description = "Deleteme main"
authors = ["Foo BAR <foo.bar@gmail.com>"]
readme = "README.md"
packages = [
    { include = "deleteme_dep", from = "src" }
]

[tool.poetry.dependencies]
python = ">=3.9, <3.10"
SimpleITK = [
    { version = "<2.1.0", markers = "sys_platform == 'linux'" },
    { version = "2.2.1", markers = "sys_platform == 'darwin'" }
]

[[tool.poetry.source]]
name = "nexus"
url = "privatenexuspull"
default = true

[[tool.poetry.source]]
name = "nexus"
url = "privatenexuspush"
default = false
secondary = true

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "deleteme_main"
version = "1.0.0"
description = "Deleteme main"
authors = ["Foo BAR <foo.bar@gmail.com>"]
readme = "README.md"
packages = [
    { include = "deleteme_main", from = "src" }
]

[tool.poetry.dependencies]
python = ">=3.9, <3.10"
deleteme_dep = "1.0.0"
SimpleITK = [
    { version = "<2.1.0", markers = "sys_platform == 'linux'" },
    { version = "2.2.1", markers = "sys_platform == 'darwin'" }
]

[[tool.poetry.source]]
name = "nexus"
url = "privatenexuspull"
default = true

[[tool.poetry.source]]
name = "nexus"
url = "privatenexuspush"
default = false
secondary = true

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

But, in my overall application, I have other dependencies.
If I use the poetry lock -vvv option:

   1: fact: deleteme_dep (1.0.0) depends on Pillow (9.4.0)
   1: fact: deleteme_dep (1.0.0) depends on loguru (0.6.0)
   1: fact: deleteme_dep (1.0.0) depends on numpy (1.23.5)
   1: fact: deleteme_dep (1.0.0) depends on pandas (1.2)
   1: fact: deleteme_dep (1.0.0) depends on python-gdcm (3.0.20)
   1: fact: deleteme_dep (1.0.0) depends on scikit-image (0.19.3)
   1: fact: deleteme_dep (1.0.0) depends on simpleitk (<2.1.0)
   1: fact: deleteme_dep (1.0.0) depends on toml (0.10.2)
   1: derived: toml (==0.10.2)
   1: conflict: deleteme_dep (1.0.0) depends on simpleitk (<2.1.0)
   1: ! deleteme_dep (==1.0.0) is satisfied by deleteme_dep (==1.0.0)
   1: ! which is caused by "deleteme_main depends on deleteme_dep (1.0.0)"
   1: ! thus: simpleitk is required
   1: ! not simpleitk (<2.1.0) is satisfied by SimpleITK (==2.2.1)
   1: ! which is caused by "deleteme_main depends on SimpleITK (2.2.1)"
   1: ! thus: version solving failed
   1: Version solving took 0.059 seconds.
   1: Tried 1 solutions.
  Stack trace:

  4  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:157 in _solve
      155156try:
    → 157result = resolve_version(self._package, self._provider)
      158159packages = result.packages

  3  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/__init__.py:18 in resolve_version
       16solver = VersionSolver(root, provider)
       17│ 
    →  18return solver.solve()
       192  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/version_solver.py:112 in solve
      110while next is not None:
      111self._propagate(next)
    → 112next = self._choose_package_version()
      113114return self._result()

  1  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/version_solver.py:428 in _choose_package_version
      426package = locked
      427│ 
    → 428package = self._provider.complete_package(package)
      429430conflict = False

  OverrideNeeded

  ({Package('deleteme_main', '0.1.0-dev0'): {'simpleitk': <Dependency SimpleITK (<2.1.0)>}}, {Package('deleteme_main', '0.1.0-dev0'): {'simpleitk': <Dependency SimpleITK (==2.2.1)>}}, {Package('deleteme_main', '0.1.0-dev0'): {'simpleitk': <Dependency SimpleITK (<empty>)>}})

  at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/provider.py:792 in complete_package
       788current_overrides.update({dependency_package: package_overrides})
       789overrides.append(current_overrides)
       790791if overrides:
    →  792raise OverrideNeeded(*overrides)
       793794# Modifying dependencies as needed
       795clean_dependencies = []
       796for dep in dependencies:

The following error occurred when trying to handle this error:


  Stack trace:

  4  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:157 in _solve
      155156try:
    → 157result = resolve_version(self._package, self._provider)
      158159packages = result.packages

  3  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/__init__.py:18 in resolve_version
       16solver = VersionSolver(root, provider)
       17│ 
    →  18return solver.solve()
       192  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/version_solver.py:111 in solve
      109next: str | None = self._root.name
      110while next is not None:
    → 111self._propagate(next)
      112next = self._choose_package_version()
      1131  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/version_solver.py:150 in _propagate
      148# where that incompatibility will allow us to derive new assignments
      149# that avoid the conflict.150root_cause = self._resolve_conflict(incompatibility)
      151152# Back jumping erases all the assignments we did at the previous

  SolveFailure

  Because deleteme_main depends on deleteme_dep (0.1.7) which depends on simpleitk (<2.1.0), simpleitk is required.
  So, because deleteme_main depends on SimpleITK (2.2.1), version solving failed.

  at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/version_solver.py:349 in _resolve_conflict
      345│             )
      346self._log(f'! which is caused by "{most_recent_satisfier.cause}"')
      347self._log(f"! thus: {incompatibility}")
      348│ 
    → 349raise SolveFailure(incompatibility)
      350351def _choose_package_version(self) -> str | None:
      352│         """
      353│         Tries to select a version of a required package.

The following error occurred when trying to handle this error:


  Stack trace:

  13  ~/.local/share/pypoetry/venv/lib/python3.9/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

  12  ~/.local/share/pypoetry/venv/lib/python3.9/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│ 

  11  ~/.local/share/pypoetry/venv/lib/python3.9/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│ 

  10  ~/.local/share/pypoetry/venv/lib/python3.9/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

   9  ~/.local/share/pypoetry/venv/lib/python3.9/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

   8  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/cleo/commands/base_command.py:119 in run
       117│         io.input.validate()
       118│ 
     → 119│         status_code = self.execute(io)
       120│ 
       121│         if status_code is None:

   7  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/cleo/commands/command.py:62 in execute
        60│ 
        61│         try:
     →  62│             return self.handle()
        63│         except KeyboardInterrupt:
        64│             return 1

   6  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/console/commands/lock.py:57 in handle
        55│         self.installer.lock(update=not self.option("no-update"))
        56│ 
     →  57│         return self.installer.run()
        58│ 

   5  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/installer.py:116 in run
       114│             self._execute_operations = False
       115│ 
     → 116│         return self._do_install()
       117│ 
       118│     def dry_run(self, dry_run: bool = True) -> Installer:

   4  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/installer.py:263 in _do_install
       261│                 source_root=self._env.path.joinpath("src")
       262│             ):
     → 263│                 ops = solver.solve(use_latest=self._whitelist).calculate_operations()
       264│         else:
       265│             self._io.write_line("Installing dependencies from lock file")

   3  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:74 in solve
        72with self._progress(), self._provider.use_latest_for(use_latest or []):
        73start = time.time()
     →  74packages, depths = self._solve()
        75end = time.time()
        762  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:161 in _solve
       159packages = result.packages
       160except OverrideNeeded as e:
     → 161return self._solve_in_compatibility_mode(e.overrides)
       162except SolveFailure as e:
       163raise SolverProblemError(e)

   1  ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:135 in _solve_in_compatibility_mode
       133│             )
       134self._provider.set_overrides(override)
     → 135_packages, _depths = self._solve()
       136for index, package in enumerate(_packages):
       137if package not in packages:

  SolverProblemError

  Because deleteme_main depends on deleteme_dep (0.1.7) which depends on simpleitk (<2.1.0), simpleitk is required.
  So, because deleteme_main depends on SimpleITK (2.2.1), version solving failed.

  at ~/.local/share/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:163 in _solve
      159packages = result.packages
      160except OverrideNeeded as e:
      161return self._solve_in_compatibility_mode(e.overrides)
      162except SolveFailure as e:
    → 163raise SolverProblemError(e)
      164165combined_nodes = depth_first_search(PackageNode(self._package, packages))
      166results = dict(aggregate_package_nodes(nodes) for nodes in combined_nodes)
      167

(sorry about the lack of information in first post and maybe the TMI in the second)

@dimbleby
Copy link
Contributor

dimbleby commented Jun 27, 2023

I don't believe this is your repro either: the log says which is caused by "deleteme_main depends on SimpleITK (2.2.1)", but neither your pyproject.toml nor your commentary matches this. Are you testing these things before posting?

I expect this is all a waste of time anyway, presumably this is a duplicate of #5506 and should be closed.

@charEtoile
Copy link
Author

charEtoile commented Jun 27, 2023

Again, I am simplifying things here, I can't post the entire application, this is a proprietary software so I have manually changed the names.
deleteme_main is equivalent to the_app and deleteme_dep is equivalent to the-dep. The idea behind this is that deleteme_main depends on deleteme_dep which depends on (SimpleITK <2.1.0 on linux or 2.2.1 on darwin).

I have read multiple times this post too but I don't understand what I should do: #5506 (comment)

Are you testing these things before posting?

Absolutely. Tested as mentioned with poetry 1.4.2 and 1.5.1. I have tried to delete referenced components from my nexus, clearing all pip and poetry caches, ...

@dimbleby
Copy link
Contributor

you are "simplifying" things to the point where they no longer reproduce the problem you are reporting, making them useless.

As best I can tell from what you have posted, this is a duplicate of #5506 and should be closed as such

@charEtoile
Copy link
Author

Dude, I am trying my best here. Whether you think my best is just crap I get it, thanks for your time, sorry for wasting it.
I know that this does not reproduce with the two deleteme*** projects that I've posted as an example. The stack trace did not come out of my mind.
I am not asking for a fix nor a lecture. I'm stuck here, I don't know where to look since the error that is reported should only happen on darwin but I am not -yet- using darwin. Maybe the error I made (or Poetry) is obvious to anyone else.

@dimbleby
Copy link
Contributor

I know that this does not reproduce with the two projects that I've posted as an example

it is hard for anyone to help you if you cannot or will not give a way to reproduce your problem.

Once again: I believe this is a duplicate of #5506. There is no solution for that issue - thats why it is open. If you want to discuss #5506, please do so in that issue - you'll have a better chance of catching the attention of people who know about it, and will leave a better trail for future travellers.

Please close

@charEtoile
Copy link
Author

Discussed in #5506

@charEtoile charEtoile closed this as not planned Won't fix, can't repro, duplicate, stale Jun 27, 2023
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants