poetry-plugin-export icon indicating copy to clipboard operation
poetry-plugin-export copied to clipboard

Transitive dependency causes Dependency walk failed at

Open absalukaskosina opened this issue 1 year ago • 0 comments

We have a common library with following setup (shorten and redacted): pyproject.toml

[tool.poetry]
name = "commons"
version = "1.2.25"
readme = "README.md"
packages = [{ include = "commons", from = "src" }]

[[tool.poetry.source]]
name = "PyPI"
priority = "primary"

[[tool.poetry.source]]
name = "jfrog"
url = "company_frog"
priority = "supplemental"


[tool.poetry.dependencies]
python = "~3.10"
numpy = [
   {version = ">=2.1.2", markers = "sys_platform != 'darwin'"},
   {version = "<2.0.0", markers = "sys_platform == 'darwin'"}
]

The reason for this is that one of our services uses Ultralytics with following PR , so in order to make it work, we had to limit Numpy for MacOS.

And second project use as dependency with following setup:

[tool.poetry]
name = "service-project"
version = "1.2.0"
readme = "README.md"

[[tool.poetry.packages]]
include = "service"
from = "src"

[[tool.poetry.source]]
name = "PyPI"
priority = "primary"

[[tool.poetry.source]]
name = "jfrog"
url = "company_frog"
priority = "supplemental"

[tool.poetry.dependencies]
python = "~3.10"
commons = "^1.2.25"

Generally poetry install works and we have no problem in development and testing.

The problem starts when we try to export requirements for docker image using

poetry export --without-hashes --format=requirements.txt --without dev,research --with-credentials > requirements.txt

Which will cause

  Stack trace:
   1  ~/.local/pipx/venvs/poetry/lib/python3.10/site-packages/poetry_plugin_export/walker.py:125 in get_project_dependencies
       123│         )
       124│
     → 125│     nested_dependencies = walk_dependencies(
       126│         dependencies=project_requires,
       127│         packages_by_name=packages_by_name,

  RuntimeError
  Dependency walk failed at numpy (>=1.21.4)

Is there any way how it is possible to make export plugin work with following setup?

absalukaskosina avatar Nov 05 '24 14:11 absalukaskosina