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 export --with dev fails with: Dependency walk failed #173

Closed
4 tasks done
Lucas-C opened this issue Jan 3, 2023 · 5 comments
Closed
4 tasks done

poetry export --with dev fails with: Dependency walk failed #173

Lucas-C opened this issue Jan 3, 2023 · 5 comments

Comments

@Lucas-C
Copy link

Lucas-C commented Jan 3, 2023

  • Poetry version: 1.3.1
  • Python version: 3.8.10
  • OS version and name: WSL (Ubuntu 20.04.5 LTS)
  • pyproject.toml:
[tool.poetry]
name = 'Thing'
version = '1.2.3'
description = 'Dummy'
authors = ['Some One']

[tool.poetry.dev-dependencies]
jsonpickle = '1.4.1'
  • 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

When running poetry -vvv export --with dev with the above minimal pyproject.toml, I get the following error:

Loading configuration file /home/lucas_cimon/.config/pypoetry/config.toml
Loading configuration file /home/lucas_cimon/.config/pypoetry/auth.toml
Source (poetry-lockfile): 1 packages found for jsonpickle 1.4.1

  Stack trace:

  12  ~/.local/lib/python3.8/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

  11  ~/.local/lib/python3.8/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│

  10  ~/.local/lib/python3.8/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│

   9  ~/.local/lib/python3.8/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

   8  ~/.local/lib/python3.8/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

   7  ~/.local/lib/python3.8/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:

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

   5  ~/.local/lib/python3.8/site-packages/poetry_plugin_export/command.py:107 in handle
       105│         exporter.with_credentials(self.option("with-credentials"))
       106│         exporter.with_urls(not self.option("without-urls"))
     → 107│         exporter.export(fmt, Path.cwd(), output or self.io)
       108│

   4  ~/.local/lib/python3.8/site-packages/poetry_plugin_export/exporter.py:86 in export
        84│             raise ValueError(f"Invalid export format: {fmt}")
        85│
     →  86│         getattr(self, self.EXPORT_METHODS[fmt])(cwd, output)
        87│
        88│     def _export_generic_txt(

   3  ~/.local/lib/python3.8/site-packages/poetry_plugin_export/exporter.py:101 in _export_generic_txt
        99│         )
       100│
     → 101│         for dependency_package in get_project_dependency_packages(
       102│             self._poetry.locker,
       103│             project_requires=root.all_requires,

   2  ~/.local/lib/python3.8/site-packages/poetry_plugin_export/walker.py:103 in get_project_dependency_packages
       101│         selected.append(dependency)
       102│
     → 103│     for package, dependency in get_project_dependencies(
       104│         project_requires=selected,
       105│         locked_packages=repository.packages,

   1  ~/.local/lib/python3.8/site-packages/poetry_plugin_export/walker.py:129 in get_project_dependencies
       127│         )
       128│
     → 129│     nested_dependencies = walk_dependencies(
       130│         dependencies=project_requires,
       131│         packages_by_name=packages_by_name,

  RuntimeError

  Dependency walk failed at jsonpickle (==1.4.1)

  at ~/.local/lib/python3.8/site-packages/poetry_plugin_export/walker.py:155 in walk_dependencies
      151│             requirement, packages_by_name, nested_dependencies
      152│         )
      153│
      154│         if not locked_package:
    → 155│             raise RuntimeError(f"Dependency walk failed at {requirement}")
      156│
      157│         if requirement.extras:
      158│             locked_package = locked_package.with_features(requirement.extras)
      159│
@Secrus Secrus transferred this issue from python-poetry/poetry Jan 3, 2023
@Lucas-C
Copy link
Author

Lucas-C commented Jan 3, 2023

Note that I do not have the poetry-plugin-export package installed in my environment

@neersighted
Copy link
Member

neersighted commented Jan 3, 2023

I'm unable to reproduce this in a container; can you please try the modifying the following reproduction attempt to reproduce?

$ docker run --rm -it python:3.8 bash
# pip install poetry==1.3.1
# poetry new reproduction && cd reproduction
# poetry add --group dev jsonpickle==1.4.1
# poetry export --with dev
[success]

@Lucas-C
Copy link
Author

Lucas-C commented Jan 4, 2023

I successfully reproduced the error with those steps:

$ docker run --rm -it python:3.8 bash
# pip install poetry==1.3.1
# cd /var/tmp/
# cat >pyproject.toml <<EOF
[tool.poetry]
name = 'Thing'
version = '1.2.3'
description = 'Dummy'
authors = ['Some One']

[tool.poetry.dev-dependencies]
jsonpickle = '1.4.1'
EOF
# poetry export --with dev

@dimbleby
Copy link
Contributor

dimbleby commented Jan 4, 2023

Add a dependency `python = "^3.10" (or whatever versions you actually want to support)

@Lucas-C
Copy link
Author

Lucas-C commented Jan 4, 2023

Thanks @dimbleby

I was able to solve my issue this way indeed:

[tool.poetry]
name = 'Thing'
version = '1.2.3'
description = 'Dummy'
authors = ['Some One']

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

[tool.poetry.dev-dependencies]
jsonpickle = '1.4.1'

Maybe poetry error message could be improved in that situation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants