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

poetry resolves wrong dependencies #7340

Closed
4 tasks done
jccalvojackson opened this issue Jan 11, 2023 · 6 comments
Closed
4 tasks done

poetry resolves wrong dependencies #7340

jccalvojackson opened this issue Jan 11, 2023 · 6 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@jccalvojackson
Copy link

jccalvojackson commented Jan 11, 2023

  • Poetry version: 1.3.2
  • Python version: 3.9.13
  • OS version and name: macOS 13.0 (M1)
  • pyproject.toml:
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

╰─ poetry add GPy -vvv     
Loading configuration file /Users/myuser/Library/Preferences/pypoetry/config.toml
Loading configuration file /Users/myuser/Library/Preferences/pypoetry/auth.toml
Adding repository mfopt (https://gitlab.com/api/v4/projects/31213480/packages/pypi/simple) and setting it as secondary
Using virtualenv: <my virtualenv>/.venv
[keyring.backend] Loading KWallet
[keyring.backend] Loading SecretService
[keyring.backend] Loading Windows
[keyring.backend] Loading chainer
[keyring.backend] Loading libsecret
[keyring.backend] Loading macOS
Creating new session for pypi.org
Source (PyPI): 36 packages found for gpy *
Creating new session for gitlab.com
[urllib3.connectionpool] Starting new HTTPS connection (1): gitlab.com:443
[urllib3.connectionpool] https://gitlab.com:443 "GET /api/v4/projects/31213480/packages/pypi/simple/gpy/ HTTP/1.1" 302 75
Source (mfopt): Response URL https://pypi.org/simple/gpy/ differs from request URL https://gitlab.com/api/v4/projects/31213480/packages/pypi/simple/gpy/
Source (mfopt): 36 packages found for gpy *
Using version ^1.10.0 for gpy

Updating dependencies
Resolving dependencies...
   1: fact: autoqt-utils is 0.2.0
   1: derived: autoqt-utils
   1: fact: autoqt-utils depends on numpy (^1.24.1)
   1: fact: autoqt-utils depends on scipy (^1.10.0)
   1: fact: autoqt-utils depends on poetry (^1.3.2)
   1: fact: autoqt-utils depends on gpy (^1.10.0)
   1: fact: autoqt-utils depends on mypy (~0.971)
   1: fact: autoqt-utils depends on pylint (~2.14.5)
   1: fact: autoqt-utils depends on black (~22.6.0)
   1: fact: autoqt-utils depends on sqlalchemy-stubs (^0.4)
   1: fact: autoqt-utils depends on isort (^5.10.1)
   1: fact: autoqt-utils depends on pytest (^7.1.2)
   1: fact: autoqt-utils depends on pytest-xdist (^2.5.0)
   1: fact: autoqt-utils depends on pytest-cov (~4.0.0)
   1: fact: autoqt-utils depends on atomicwrites (^1.4.1)
   1: fact: autoqt-utils depends on jupyter (^1.0.0)
   1: fact: autoqt-utils depends on jupytext (^1.14.1)
   1: fact: autoqt-utils depends on types-setuptools (^63.4.0)
   1: fact: autoqt-utils depends on pre-commit (^2.21.0)
   1: selecting autoqt-utils (0.2.0)
   1: derived: pre-commit (>=2.21.0,<3.0.0)
   1: derived: types-setuptools (>=63.4.0,<64.0.0)
   1: derived: jupytext (>=1.14.1,<2.0.0)
   1: derived: jupyter (>=1.0.0,<2.0.0)
   1: derived: atomicwrites (>=1.4.1,<2.0.0)
   1: derived: pytest-cov (>=4.0.0,<4.1.0)
   1: derived: pytest-xdist (>=2.5.0,<3.0.0)
   1: derived: pytest (>=7.1.2,<8.0.0)
   1: derived: isort (>=5.10.1,<6.0.0)
   1: derived: sqlalchemy-stubs (>=0.4,<0.5)
   1: derived: black (>=22.6.0,<22.7.0)
   1: derived: pylint (>=2.14.5,<2.15.0)
   1: derived: mypy (>=0.971,<0.972)
   1: derived: gpy (>=1.10.0,<2.0.0)
   1: derived: poetry (>=1.3.2,<2.0.0)
   1: derived: scipy (>=1.10.0,<2.0.0)
   1: derived: numpy (>=1.24.1,<2.0.0)
Source (PyPI): 1 packages found for gpy >=1.10.0,<2.0.0
Source (mfopt): 1 packages found for gpy >=1.10.0,<2.0.0
   1: fact: gpy (1.10.0) depends on numpy (>=1.7)
   1: fact: gpy (1.10.0) depends on six (*)
   1: fact: gpy (1.10.0) depends on paramz (>=0.9.0)
   1: fact: gpy (1.10.0) depends on cython (>=0.29)
   1: fact: gpy (1.10.0) depends on scipy (>=1.3.0,<1.5.0)
   1: derived: not gpy (==1.10.0)
   1: fact: no versions of gpy match >1.10.0,<2.0.0
   1: conflict: no versions of gpy match >1.10.0,<2.0.0
   1: ! gpy (>1.10.0,<2.0.0) is partially satisfied by not gpy (==1.10.0)
   1: ! which is caused by "gpy (1.10.0) depends on scipy (>=1.3.0,<1.5.0)"
   1: ! thus: gpy (>=1.10.0,<2.0.0) requires scipy (>=1.3.0,<1.5.0)
   1: ! not scipy (>=1.3.0,<1.5.0) is satisfied by scipy (>=1.10.0,<2.0.0)
   1: ! which is caused by "autoqt-utils depends on scipy (^1.10.0)"
   1: ! thus: gpy is forbidden
   1: ! gpy (>=1.10.0,<2.0.0) is satisfied by gpy (>=1.10.0,<2.0.0)
   1: ! which is caused by "autoqt-utils depends on gpy (^1.10.0)"
   1: ! thus: version solving failed
   1: Version solving took 0.016 seconds.
   1: Tried 1 solutions.

  Stack trace:

  4  ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/puzzle/solver.py:157 in _solve
      155│ 
      156│         try:
    → 157│             result = resolve_version(self._package, self._provider)
      158│ 
      159│             packages = result.packages

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

  2  ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/version_solver.py:111 in solve
      109│             next: str | None = self._root.name
      110│             while next is not None:
    → 111│                 self._propagate(next)
      112│                 next = self._choose_package_version()
      113│ 

  1  ~/Library/Application Support/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.
    → 150│                     root_cause = self._resolve_conflict(incompatibility)
      151│ 
      152│                     # Back jumping erases all the assignments we did at the previous

  SolveFailure

  Because no versions of gpy match >1.10.0,<2.0.0
   and gpy (1.10.0) depends on scipy (>=1.3.0,<1.5.0), gpy (>=1.10.0,<2.0.0) requires scipy (>=1.3.0,<1.5.0).
  So, because autoqt-utils depends on both scipy (^1.10.0) and gpy (^1.10.0), version solving failed.

  at ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/mixology/version_solver.py:349 in _resolve_conflict
      345│             )
      346│             self._log(f'! which is caused by "{most_recent_satisfier.cause}"')
      347│             self._log(f"! thus: {incompatibility}")
      348│ 
    → 349│         raise SolveFailure(incompatibility)
      350│ 
      351│     def _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:

  11  ~/Library/Application Support/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

  10  ~/Library/Application Support/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│ 

   9  ~/Library/Application Support/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│ 

   8  ~/Library/Application Support/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

   7  ~/Library/Application Support/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

   6  ~/Library/Application Support/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:

   5  ~/Library/Application Support/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

   4  ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/console/commands/add.py:260 in handle
       258│         self.installer.whitelist([r["name"] for r in requirements])
       259│ 
     → 260│         status = self.installer.run()
       261│ 
       262│         if status == 0 and not self.option("dry-run"):

   3  ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/installer.py:114 in run
       112│             self._execute_operations = False
       113│ 
     → 114│         return self._do_install()
       115│ 
       116│     def dry_run(self, dry_run: bool = True) -> Installer:

   2  ~/Library/Application Support/pypoetry/venv/lib/python3.9/site-packages/poetry/installation/installer.py:253 in _do_install
       251│                 source_root=self._env.path.joinpath("src")
       252│             ):
     → 253│                 ops = solver.solve(use_latest=self._whitelist).calculate_operations()
       254│         else:
       255│             self._io.write_line("Installing dependencies from lock file")

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

  SolverProblemError

  Because no versions of gpy match >1.10.0,<2.0.0
   and gpy (1.10.0) depends on scipy (>=1.3.0,<1.5.0), gpy (>=1.10.0,<2.0.0) requires scipy (>=1.3.0,<1.5.0).
  So, because autoqt-utils depends on both scipy (^1.10.0) and gpy (^1.10.0), version solving failed.

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

However, if you go to GPy you see that for python versions 3.6 and above (look at the setup.py) the requirement is scipy>=1.3.0 not scipy>=1.3.0,<1.5.0.

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

poetry is not a python interpreter. Please encourage packages to use pep508 markers when declaring dependencies, rather than conditional logic in setup.py

@jccalvojackson
Copy link
Author

I see, thank you!

@jccalvojackson
Copy link
Author

submitted this MR to GPy then

@dimbleby
Copy link
Contributor

nice (though I think you didn't want install_requirements += matplotlib_version)

`

@jccalvojackson
Copy link
Author

got it. fixed it

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