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

Failed to poetry add with false version conflict #8514

Closed
4 tasks done
hkak03key opened this issue Oct 6, 2023 · 2 comments
Closed
4 tasks done

Failed to poetry add with false version conflict #8514

hkak03key opened this issue Oct 6, 2023 · 2 comments
Labels
kind/bug Something isn't working as expected

Comments

@hkak03key
Copy link

  • Poetry version: Poetry (version 1.6.1)
  • Python version: Python: 3.9.16
  • OS version and name: macOS 13.4.1
  • pyproject.toml:
[tool.poetry]
name = "test"
version = "0.1.0"
description = ""
authors = ["Hikaru <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.9"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"
  • 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

I tried to install "sqlalchemy-bigquery" but failed with version conflict.
But I think this is the false error.

log
$ poetry add "sqlalchemy-bigquery"
Using version ^1.8.0 for sqlalchemy-bigquery

Updating dependencies
Resolving dependencies... (0.0s)

The current project's Python requirement (>=3.9,<4.0) is not compatible with some of the required packages Python requirement:
  - sqlalchemy-bigquery requires Python >=3.7, <3.12, so it will not be satisfied for Python >=3.12,<4.0

Because no versions of sqlalchemy-bigquery match >1.8.0,<2.0.0
 and sqlalchemy-bigquery (1.8.0) requires Python >=3.7, <3.12, sqlalchemy-bigquery is forbidden.
So, because test depends on sqlalchemy-bigquery (^1.8.0), version solving failed.

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

    For sqlalchemy-bigquery, a possible solution would be to set the `python` property to ">=3.9,<3.12"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers
log (debug)
$ poetry add -vvv "sqlalchemy-bigquery"
Using virtualenv: /Users/murakami_hikaru/Library/Caches/pypoetry/virtualenvs/test-2WwrecSa-py3.9
[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): 20 packages found for sqlalchemy-bigquery *
Using version ^1.8.0 for sqlalchemy-bigquery

Updating dependencies
Resolving dependencies...
   1: fact: test is 0.1.0
   1: derived: test
   1: fact: test depends on sqlalchemy-bigquery (^1.8.0)
   1: selecting test (0.1.0)
   1: derived: sqlalchemy-bigquery (>=1.8.0,<2.0.0)
Source (PyPI): 1 packages found for sqlalchemy-bigquery >=1.8.0,<2.0.0
   1: fact: sqlalchemy-bigquery (1.8.0) requires Python >=3.7, <3.12
   1: derived: not sqlalchemy-bigquery (==1.8.0)
Source (PyPI): 0 packages found for sqlalchemy-bigquery >1.8.0,<2.0.0
Falling back to installed packages to discover metadata for sqlalchemy-bigquery
Found 0 compatible packages for sqlalchemy-bigquery
   1: fact: no versions of sqlalchemy-bigquery match >1.8.0,<2.0.0
   1: conflict: no versions of sqlalchemy-bigquery match >1.8.0,<2.0.0
   1: ! sqlalchemy-bigquery (>1.8.0,<2.0.0) is partially satisfied by not sqlalchemy-bigquery (==1.8.0)
   1: ! which is caused by "sqlalchemy-bigquery (1.8.0) requires Python >=3.7, <3.12"
   1: ! thus: sqlalchemy-bigquery is forbidden
   1: ! sqlalchemy-bigquery (>=1.8.0,<2.0.0) is satisfied by sqlalchemy-bigquery (>=1.8.0,<2.0.0)
   1: ! which is caused by "test depends on sqlalchemy-bigquery (^1.8.0)"
   1: ! thus: version solving failed
   1: Version solving took 0.013 seconds.
   1: Tried 1 solutions.

  Stack trace:

  4  ~/.anyenv/envs/pyenv/versions/3.9.16/lib/python3.9/site-packages/poetry/puzzle/solver.py:155 in _solve
      153│
      154│         try:
    → 155│             result = resolve_version(self._package, self._provider)
      156│
      157│             packages = result.packages

  3  ~/.anyenv/envs/pyenv/versions/3.9.16/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  ~/.anyenv/envs/pyenv/versions/3.9.16/lib/python3.9/site-packages/poetry/mixology/version_solver.py:163 in solve
      161│             next: str | None = self._root.name
      162│             while next is not None:
    → 163│                 self._propagate(next)
      164│                 next = self._choose_package_version()
      165│

  1  ~/.anyenv/envs/pyenv/versions/3.9.16/lib/python3.9/site-packages/poetry/mixology/version_solver.py:202 in _propagate
      200│                     # where that incompatibility will allow us to derive new assignments
      201│                     # that avoid the conflict.
    → 202│                     root_cause = self._resolve_conflict(incompatibility)
      203│
      204│                     # Back jumping erases all the assignments we did at the previous

  SolveFailure

  The current project's Python requirement (>=3.9,<4.0) is not compatible with some of the required packages Python requirement:
    - sqlalchemy-bigquery requires Python >=3.7, <3.12, so it will not be satisfied for Python >=3.12,<4.0

  Because no versions of sqlalchemy-bigquery match >1.8.0,<2.0.0
   and sqlalchemy-bigquery (1.8.0) requires Python >=3.7, <3.12, sqlalchemy-bigquery is forbidden.
  So, because test depends on sqlalchemy-bigquery (^1.8.0), version solving failed.

  at ~/.anyenv/envs/pyenv/versions/3.9.16/lib/python3.9/site-packages/poetry/mixology/version_solver.py:416 in _resolve_conflict
      412│             )
      413│             self._log(f'! which is caused by "{most_recent_satisfier.cause}"')
      414│             self._log(f"! thus: {incompatibility}")
      415│
    → 416│         raise SolveFailure(incompatibility)
      417│
      418│     def _choose_package_version(self) -> str | None:
      419│         """
      420│         Tries to select a version of a required package.

The following error occurred when trying to handle this error:


  Stack trace:

  11  ~/.anyenv/envs/pyenv/versions/3.9.16/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  ~/.anyenv/envs/pyenv/versions/3.9.16/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  ~/.anyenv/envs/pyenv/versions/3.9.16/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  ~/.anyenv/envs/pyenv/versions/3.9.16/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  ~/.anyenv/envs/pyenv/versions/3.9.16/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  ~/.anyenv/envs/pyenv/versions/3.9.16/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  ~/.anyenv/envs/pyenv/versions/3.9.16/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  ~/.anyenv/envs/pyenv/versions/3.9.16/lib/python3.9/site-packages/poetry/console/commands/add.py:267 in handle
       265│         self.installer.whitelist([r["name"] for r in requirements])
       266│
     → 267│         status = self.installer.run()
       268│
       269│         if status == 0 and not self.option("dry-run"):

   3  ~/.anyenv/envs/pyenv/versions/3.9.16/lib/python3.9/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:

   2  ~/.anyenv/envs/pyenv/versions/3.9.16/lib/python3.9/site-packages/poetry/installation/installer.py:241 in _do_install
       239│                 source_root=self._env.path.joinpath("src")
       240│             ):
     → 241│                 ops = solver.solve(use_latest=self._whitelist).calculate_operations()
       242│         else:
       243│             self._io.write_line("Installing dependencies from lock file")

   1  ~/.anyenv/envs/pyenv/versions/3.9.16/lib/python3.9/site-packages/poetry/puzzle/solver.py:72 in solve
        70│         with self._progress(), self._provider.use_latest_for(use_latest or []):
        71│             start = time.time()
     →  72│             packages, depths = self._solve()
        73│             end = time.time()
        74│

  SolverProblemError

  The current project's Python requirement (>=3.9,<4.0) is not compatible with some of the required packages Python requirement:
    - sqlalchemy-bigquery requires Python >=3.7, <3.12, so it will not be satisfied for Python >=3.12,<4.0

  Because no versions of sqlalchemy-bigquery match >1.8.0,<2.0.0
   and sqlalchemy-bigquery (1.8.0) requires Python >=3.7, <3.12, sqlalchemy-bigquery is forbidden.
  So, because test depends on sqlalchemy-bigquery (^1.8.0), version solving failed.

  at ~/.anyenv/envs/pyenv/versions/3.9.16/lib/python3.9/site-packages/poetry/puzzle/solver.py:161 in _solve
      157│             packages = result.packages
      158│         except OverrideNeeded as e:
      159│             return self._solve_in_compatibility_mode(e.overrides)
      160│         except SolveFailure as e:
    → 161│             raise SolverProblemError(e)
      162│
      163│         combined_nodes = depth_first_search(PackageNode(self._package, packages))
      164│         results = dict(aggregate_package_nodes(nodes) for nodes in combined_nodes)
      165│

  • Check your dependencies Python requirement: The Python requirement can be specified via the `python` or `markers` properties

    For sqlalchemy-bigquery, a possible solution would be to set the `python` property to ">=3.9,<3.12"

    https://python-poetry.org/docs/dependency-specification/#python-restricted-dependencies,
    https://python-poetry.org/docs/dependency-specification/#using-environment-markers

If using venv directly, I can install sqlalchemy-bigquery.

log
$ python -m venv .venv
$ . .venv/bin/activate
$ pip install "sqlalchemy-bigquery"
Collecting sqlalchemy-bigquery
  Using cached sqlalchemy_bigquery-1.8.0-py2.py3-none-any.whl (33 kB)
Collecting packaging
  Using cached packaging-23.2-py3-none-any.whl (53 kB)
Collecting google-api-core!=2.0.*,!=2.1.*,!=2.2.*,!=2.3.0,<3.0.0dev,>=1.31.5
  Downloading google_api_core-2.12.0-py3-none-any.whl (121 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 121.4/121.4 KB 7.9 MB/s eta 0:00:00
Collecting sqlalchemy<2.0.0dev,>=1.2.0
  Using cached SQLAlchemy-1.4.49.tar.gz (8.5 MB)
  Preparing metadata (setup.py) ... done
Collecting google-auth<3.0.0dev,>=1.25.0
  Downloading google_auth-2.23.2-py2.py3-none-any.whl (181 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 182.0/182.0 KB 15.0 MB/s eta 0:00:00
Collecting google-cloud-bigquery<4.0.0dev,>=2.25.2
  Downloading google_cloud_bigquery-3.12.0-py2.py3-none-any.whl (220 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 220.4/220.4 KB 17.4 MB/s eta 0:00:00
Collecting protobuf!=3.20.0,!=3.20.1,!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0.dev0,>=3.19.5
  Downloading protobuf-4.24.4-cp37-abi3-macosx_10_9_universal2.whl (409 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 409.4/409.4 KB 19.0 MB/s eta 0:00:00
Collecting requests<3.0.0.dev0,>=2.18.0
  Using cached requests-2.31.0-py3-none-any.whl (62 kB)
Collecting googleapis-common-protos<2.0.dev0,>=1.56.2
  Downloading googleapis_common_protos-1.60.0-py2.py3-none-any.whl (227 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 227.6/227.6 KB 10.2 MB/s eta 0:00:00
Collecting cachetools<6.0,>=2.0.0
  Downloading cachetools-5.3.1-py3-none-any.whl (9.3 kB)
Collecting pyasn1-modules>=0.2.1
  Using cached pyasn1_modules-0.3.0-py2.py3-none-any.whl (181 kB)
Collecting rsa<5,>=3.1.4
  Using cached rsa-4.9-py3-none-any.whl (34 kB)
Collecting grpcio<2.0dev,>=1.47.0
  Downloading grpcio-1.59.0-cp39-cp39-macosx_10_10_universal2.whl (9.6 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 9.6/9.6 MB 25.5 MB/s eta 0:00:00
Collecting google-cloud-core<3.0.0dev,>=1.6.0
  Downloading google_cloud_core-2.3.3-py2.py3-none-any.whl (29 kB)
Collecting proto-plus<2.0.0dev,>=1.15.0
  Downloading proto_plus-1.22.3-py3-none-any.whl (48 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 48.1/48.1 KB 6.4 MB/s eta 0:00:00
Collecting google-resumable-media<3.0dev,>=0.6.0
  Downloading google_resumable_media-2.6.0-py2.py3-none-any.whl (80 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 80.3/80.3 KB 12.8 MB/s eta 0:00:00
Collecting python-dateutil<3.0dev,>=2.7.2
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting grpcio-status<2.0.dev0,>=1.33.2
  Downloading grpcio_status-1.59.0-py3-none-any.whl (14 kB)
Collecting google-crc32c<2.0dev,>=1.0
  Using cached google_crc32c-1.5.0-cp39-cp39-macosx_10_9_universal2.whl (32 kB)
Collecting pyasn1<0.6.0,>=0.4.6
  Using cached pyasn1-0.5.0-py2.py3-none-any.whl (83 kB)
Collecting six>=1.5
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Collecting idna<4,>=2.5
  Using cached idna-3.4-py3-none-any.whl (61 kB)
Collecting urllib3<3,>=1.21.1
  Downloading urllib3-2.0.6-py3-none-any.whl (123 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 123.8/123.8 KB 20.5 MB/s eta 0:00:00
Collecting charset-normalizer<4,>=2
  Downloading charset_normalizer-3.3.0-cp39-cp39-macosx_11_0_arm64.whl (117 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 117.8/117.8 KB 15.7 MB/s eta 0:00:00
Collecting certifi>=2017.4.17
  Using cached certifi-2023.7.22-py3-none-any.whl (158 kB)
Using legacy 'setup.py install' for sqlalchemy, since package 'wheel' is not installed.
Installing collected packages: urllib3, sqlalchemy, six, pyasn1, protobuf, packaging, idna, grpcio, google-crc32c, charset-normalizer, certifi, cachetools, rsa, requests, python-dateutil, pyasn1-modules, proto-plus, googleapis-common-protos, google-resumable-media, grpcio-status, google-auth, google-api-core, google-cloud-core, google-cloud-bigquery, sqlalchemy-bigquery
  Running setup.py install for sqlalchemy ... done
Successfully installed cachetools-5.3.1 certifi-2023.7.22 charset-normalizer-3.3.0 google-api-core-2.12.0 google-auth-2.23.2 google-cloud-bigquery-3.12.0 google-cloud-core-2.3.3 google-crc32c-1.5.0 google-resumable-media-2.6.0 googleapis-common-protos-1.60.0 grpcio-1.59.0 grpcio-status-1.59.0 idna-3.4 packaging-23.2 proto-plus-1.22.3 protobuf-4.24.4 pyasn1-0.5.0 pyasn1-modules-0.3.0 python-dateutil-2.8.2 requests-2.31.0 rsa-4.9 six-1.16.0 sqlalchemy-1.4.49 sqlalchemy-bigquery-1.8.0 urllib3-2.0.6
WARNING: You are using pip version 22.0.4; however, version 23.2.1 is available.
You should consider upgrading via the '/Users/murakami_hikaru/Workspace/adhoc/2023-10-06/.venv/bin/python -m pip install --upgrade pip' command.

@hkak03key hkak03key added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 6, 2023
@hkak03key
Copy link
Author

sorry, I have found the solution:

abount pyproject.toml, replace python = "^3.9" to python = "~3.9" .

ref:
https://python-poetry.org/docs/dependency-specification/

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
@abn abn removed the status/triage This issue needs to be triaged label Mar 2, 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
Projects
None yet
Development

No branches or pull requests

2 participants