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] #680

Closed
sjquant opened this issue Jul 21, 2019 · 6 comments
Closed

poetry add pydantic raises [AssertionError] #680

sjquant opened this issue Jul 21, 2019 · 6 comments

Comments

@sjquant
Copy link

sjquant commented Jul 21, 2019

Bug

For bugs/questions:

  • OS: Ubuntu 18.04
  • Python version import sys; print(sys.version): ?
  • Pydantic version: (before install)

I use poetry for my dependency managing tool, but when i use poetry add pydantic it raises AssertionError as follows. Any other packages work fine. Unfortunately, I don't know why... Is there any solution for this issue?

Using version ^0.30.1 for pydantic

Updating dependencies
Resolving dependencies... (0.0s)
                                 
[AssertionError]  
                                 
add [-D|--dev] [--git GIT] [--path PATH] [-E|--extras EXTRAS] [--optional] [--python PYTHON] [--platform PLATFORM] [--allow-prereleases] [--dry-run] [--] <name> (<name>)...
@samuelcolvin
Copy link
Member

Python version?

@samuelcolvin
Copy link
Member

If this is really all you get in terms of error message, I think you should report or to poetry - at least for the lack of further information.

@dmontagu
Copy link
Contributor

I’ve been using pydantic with poetry exclusively without an issue, but haven’t run poetry add pydantic. I just put it in pyproject.toml and run poetry update / poetry lock.

@sjquant try running poetry add pydantic -vvv; that should give more verbose information about what’s going wrong (if not, it’s definitely worth a poetry issue). Also, which version of poetry are you using?

@senpos
Copy link

senpos commented Jul 22, 2019

Did not reproduce this issue on Python 3.7.3 & Windows 7 & poetry 0.12.17

@sjquant
Copy link
Author

sjquant commented Jul 23, 2019

It worked suddenly. Sorry for inconvinience. I'll close this issue.

@sjquant sjquant closed this as completed Jul 23, 2019
@mgautam98
Copy link

I am getting same error with poetry add pydantic I tried putting it in projects.toml and run poetry update / poetry lock but getting same error.

❯ python3 --version
Python 3.9.5

❯ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 21.04
Release:        21.04
Codename:       hirsute

From the trace it looks like a poetry issue

❯ 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()

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

5 participants