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 add pydantic raises [AssertionError] #4225

Closed
3 tasks done
mgautam98 opened this issue Jun 28, 2021 · 2 comments
Closed
3 tasks done

poetry add pydantic raises [AssertionError] #4225

mgautam98 opened this issue Jun 28, 2021 · 2 comments
Labels
status/duplicate Duplicate issues

Comments

@mgautam98
Copy link

  • I am on the latest Poetry version.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).
  • OS version and name: Ubuntu 21.04
  • Poetry version: Poetry version 1.1.7
  • Link of a Gist with the contents of your pyproject.toml file: Gist Link

Issue

poetry add pydantic it raises AssertionError as follows. There is an old issue raised on pydantic as well but no so helpful. I also tried putting it in projects.toml and run poetry update / poetry lock but getting same error.

❯ poetry add pydantic -vvv
Using virtualenv: /home/user1/.cache/pypoetry/virtualenvs/pydantic-3-9acRr3-py3.9
PyPI: 78 packages found for pydantic *
Using version ^1.8.2 for pydantic

Updating dependencies
Resolving dependencies...
   1: fact: pydantic is 0.1.0
   1: derived: pydantic
   1: Version solving took 0.004 seconds.
   1: Tried 1 solutions.

  Stack trace:

  13  ~/.poetry/lib/poetry/_vendor/py3.9/clikit/console_application.py:131 in run
       129│             parsed_args = resolved_command.args
       130│ 
     → 131│             status_code = command.handle(parsed_args, io)
       132│         except KeyboardInterrupt:
       133│             status_code = 1

  12  ~/.poetry/lib/poetry/_vendor/py3.9/clikit/api/command/command.py:120 in handle
       118│     def handle(self, args, io):  # type: (Args, IO) -> int
       119│         try:
     → 120│             status_code = self._do_handle(args, io)
       121│         except KeyboardInterrupt:
       122│             if io.is_debug():

  11  ~/.poetry/lib/poetry/_vendor/py3.9/clikit/api/command/command.py:171 in _do_handle
       169│         handler_method = self._config.handler_method
       170│ 
     → 171│         return getattr(handler, handler_method)(args, io, self)
       172│ 
       173│     def __repr__(self):  # type: () -> str

  10  ~/.poetry/lib/poetry/_vendor/py3.9/cleo/commands/command.py:92 in wrap_handle
        90│         self._command = command
        91│ 
     →  92│         return self.handle()
        93│ 
        94│     def handle(self):  # type: () -> Optional[int]

   9  ~/.poetry/lib/poetry/console/commands/add.py:173 in handle
       171│             self._installer.whitelist([r["name"] for r in requirements])
       172│ 
     → 173│             status = self._installer.run()
       174│         except BaseException:
       175│             # Using BaseException here as some exceptions, eg: KeyboardInterrupt, do not inherit from Exception

   8  ~/.poetry/lib/poetry/installation/installer.py:103 in run
       101│         local_repo = Repository()
       102│ 
     → 103│         return self._do_install(local_repo)
       104│ 
       105│     def dry_run(self, dry_run=True):  # type: (bool) -> Installer

   7  ~/.poetry/lib/poetry/installation/installer.py:235 in _do_install
       233│             )
       234│ 
     → 235│             ops = solver.solve(use_latest=self._whitelist)
       236│         else:
       237│             self._io.write_line("Installing dependencies from lock file")

   6  ~/.poetry/lib/poetry/puzzle/solver.py:65 in solve
        63│         with self._provider.progress():
        64│             start = time.time()
     →  65│             packages, depths = self._solve(use_latest=use_latest)
        66│             end = time.time()
        67│ 

   5  ~/.poetry/lib/poetry/puzzle/solver.py:233 in _solve
       231│ 
       232│         try:
     → 233│             result = resolve_version(
       234│                 self._package, self._provider, locked=locked, use_latest=use_latest
       235│             )

   4  ~/.poetry/lib/poetry/mixology/__init__.py:7 in resolve_version
       5│     solver = VersionSolver(root, provider, locked=locked, use_latest=use_latest)
       6│ 
     → 7│     return solver.solve()
       8│ 

   3  ~/.poetry/lib/poetry/mixology/version_solver.py:84 in solve
        82│             while next is not None:
        83│                 self._propagate(next)
     →  84│                 next = self._choose_package_version()
        85│ 
        86│             return self._result()

   2  ~/.poetry/lib/poetry/mixology/version_solver.py:404 in _choose_package_version
       402│         conflict = False
       403│         for incompatibility in self._provider.incompatibilities_for(version):
     → 404│             self._add_incompatibility(incompatibility)
       405│ 
       406│             # If an incompatibility is already satisfied, then selecting version

   1  ~/.poetry/lib/poetry/mixology/version_solver.py:445 in _add_incompatibility
       443│ 
       444│     def _add_incompatibility(self, incompatibility):  # type: (Incompatibility) -> None
     → 445│         self._log("fact: {}".format(incompatibility))
       446│ 
       447│         for term in incompatibility.terms:

  AssertionError

  

  at ~/.poetry/lib/poetry/mixology/incompatibility.py:111 in __str__
      107│         )
      108│ 
      109│     def __str__(self):
      110│         if isinstance(self._cause, DependencyCause):
    → 111│             assert len(self._terms) == 2
      112│ 
      113│             depender = self._terms[0]
      114│             dependee = self._terms[1]
      115│             assert depender.is_positive()

@mgautam98 mgautam98 added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 28, 2021
@finswimmer
Copy link
Member

Hello @mgautam98,

you cannot name your package like a dependency.

Duplicate of #236.

fin swimmer

@finswimmer finswimmer added status/duplicate Duplicate issues and removed kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jun 28, 2021
Copy link

github-actions bot commented Mar 2, 2024

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 Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

2 participants