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

Cannot resolve dependencies after upgrading to 1.2.0 #6435

Closed
3 tasks done
miquecg opened this issue Sep 7, 2022 · 4 comments
Closed
3 tasks done

Cannot resolve dependencies after upgrading to 1.2.0 #6435

miquecg opened this issue Sep 7, 2022 · 4 comments
Labels
kind/bug Something isn't working as expected status/duplicate Duplicate issues

Comments

@miquecg
Copy link

miquecg commented Sep 7, 2022

  • 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: Arch Linux + KDE

  • Poetry version: 1.2.0

  • Link of a Gist with the contents of your pyproject.toml file:

Issue

With latest poetry version I cannot update or install any of the projects I regularly use. First thing I've noticed is that dependency resolving gets stucked indefinitely. Taking a closer look at the issue I've tried toggling this configuration:

experimental.system-git-client = false | true

Changing that led me to find this error message:

[org.freedesktop.DBus.Error.UnknownObject] ("No such object path '/org/freedesktop/secrets/aliases/default'",)

Something is going on involving the secrets provider, KeePassXC for the record and not the default KDE Wallet, which btw is also installed. Maybe git dependencies are being cloned as git@github.com, thus asking for a passphrase? That was my first guess but no clue.

So I've tried to reproduce the problem with a fresh new project and it turns out results are the same.

❯ poetry init
# Create a new project and add a few dependencies...

❯ poetry install -vvv
Loading configuration file /home/user/.config/pypoetry/config.toml
Using virtualenv: /home/user/.cache/pypoetry/virtualenvs/foo-2KZ9Hv4C-py3.10
Project environment contains an empty path in sys_path, ignoring.
Updating dependencies
Resolving dependencies...
   1: fact: foo is 0.1.0
   1: derived: foo
   1: fact: foo depends on PyYAML (^6.0)
   1: fact: foo depends on plantuml (^0.3.0)
   1: fact: foo depends on requests (^2.28.1)
   1: fact: foo depends on names (^0.3.0)
   1: selecting foo (0.1.0)
   1: derived: names (>=0.3.0,<0.4.0)
   1: derived: requests (>=2.28.1,<3.0.0)
   1: derived: plantuml (>=0.3.0,<0.4.0)
   1: derived: PyYAML (>=6.0,<7.0)
[keyring.backend] Loading KWallet
[keyring.backend] Loading SecretService
[keyring.backend] Loading Windows
[keyring.backend] Loading chainer
[keyring.backend] Loading libsecret
[keyring.backend] Loading macOS
   1: Version solving took 0.092 seconds.
   1: Tried 1 solutions.

  Stack trace:

  40  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:329 in run
       327│ 
       328│             try:
     → 329│                 exit_code = self._run(io)
       330│             except Exception as e:
       331│                 if not self._catch_exceptions:

  39  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/console/application.py:185 in _run
       183│         self._load_plugins(io)
       184│ 
     → 185│         exit_code: int = super()._run(io)
       186│         return exit_code
       187│ 

  38  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:423 in _run
       421│             io.input.set_stream(stream)
       422│ 
     → 423│         exit_code = self._run_command(command, io)
       424│         self._running_command = None
       425│ 

  37  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:465 in _run_command
       463│ 
       464│         if error is not None:
     → 465│             raise error
       466│ 
       467│         return event.exit_code

  36  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/application.py:449 in _run_command
       447│ 
       448│             if event.command_should_run():
     → 449│                 exit_code = command.run(io)
       450│             else:
       451│                 exit_code = ConsoleCommandEvent.RETURN_CODE_DISABLED

  35  ~/.local/share/pypoetry/venv/lib/python3.10/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:

  34  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cleo/commands/command.py:83 in execute
        81│ 
        82│         try:
     →  83│             return self.handle()
        84│         except KeyboardInterrupt:
        85│             return 1

  33  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/console/commands/install.py:145 in handle
       143│         self.installer.verbose(self.io.is_verbose())
       144│ 
     → 145│         return_code = self.installer.run()
       146│ 
       147│         if return_code != 0:

  32  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/installer.py:111 in run
       109│             self._execute_operations = False
       110│ 
     → 111│         return self._do_install()
       112│ 
       113│     def dry_run(self, dry_run: bool = True) -> Installer:

  31  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/installation/installer.py:244 in _do_install
       242│                 source_root=self._env.path.joinpath("src")
       243│             ):
     → 244│                 ops = solver.solve(use_latest=self._whitelist).calculate_operations()
       245│         else:
       246│             self._io.write_line("Installing dependencies from lock file")

  30  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/puzzle/solver.py:73 in solve
        71│         with self._provider.progress():
        72│             start = time.time()
     →  73│             packages, depths = self._solve(use_latest=use_latest)
        74│             end = time.time()
        75│ 

  29  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/puzzle/solver.py:151 in _solve
       149│ 
       150│         try:
     → 151│             result = resolve_version(
       152│                 self._package, self._provider, locked=locked, use_latest=use_latest
       153│             )

  28  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/mixology/__init__.py:24 in resolve_version
        22│     solver = VersionSolver(root, provider, locked=locked, use_latest=use_latest)
        23│ 
     →  24│     return solver.solve()
        25│ 

  27  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/mixology/version_solver.py:127 in solve
       125│             while next is not None:
       126│                 self._propagate(next)
     → 127│                 next = self._choose_package_version()
       128│ 
       129│             return self._result()

  26  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/mixology/version_solver.py:407 in _choose_package_version
       405│             dependency = unsatisfied[0]
       406│         else:
     → 407│             dependency = min(*unsatisfied, key=_get_min)
       408│ 
       409│         locked = self._get_locked(dependency)

  25  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/mixology/version_solver.py:399 in _get_min
       397│                 return (
       398│                     not dependency.marker.is_any(),
     → 399│                     len(self._dependency_cache.search_for(dependency)),
       400│                 )
       401│             except ValueError:

  24  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/mixology/version_solver.py:62 in _search_for
        60│         packages = self.cache.get(key)
        61│         if packages is None:
     →  62│             packages = self.provider.search_for(dependency)
        63│         else:
        64│             packages = [

  23  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/puzzle/provider.py:289 in search_for
       287│             return PackageCollection(dependency, packages)
       288│ 
     → 289│         packages = self._pool.find_packages(dependency)
       290│ 
       291│         packages.sort(

  22  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/repositories/pool.py:181 in find_packages
       179│         packages = []
       180│         for repo in self._repositories:
     → 181│             packages += repo.find_packages(dependency)
       182│ 
       183│         return packages

  21  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/repositories/repository.py:46 in find_packages
        44│         ignored_pre_release_packages = []
        45│ 
     →  46│         for package in self._find_packages(dependency.name, constraint):
        47│             if package.yanked and not isinstance(constraint, Version):
        48│                 # PEP 592: yanked files are always ignored, unless they are the only

  20  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/repositories/pypi_repository.py:116 in _find_packages
       114│         """
       115│         try:
     → 116│             info = self.get_package_info(name)
       117│         except PackageNotFound:
       118│             self._log(

  19  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/repositories/pypi_repository.py:104 in get_package_info
       102│             return self._get_package_info(name)
       103│ 
     → 104│         package_info: dict[str, Any] = self._cache.store("packages").remember_forever(
       105│             name, lambda: self._get_package_info(name)
       106│         )

  18  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cachy/repository.py:174 in remember_forever
       172│             return val
       173│ 
     → 174│         val = value(callback)
       175│ 
       176│         self.forever(key, val)

  17  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/cachy/helpers.py:6 in value
         4│ def value(val):
         5│     if callable(val):
     →   6│         return val()
         7│ 
         8│     return val

  16  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/repositories/pypi_repository.py:105 in <lambda>
       103│ 
       104│         package_info: dict[str, Any] = self._cache.store("packages").remember_forever(
     → 105│             name, lambda: self._get_package_info(name)
       106│         )
       107│         return package_info

  15  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/repositories/pypi_repository.py:155 in _get_package_info
       153│ 
       154│     def _get_package_info(self, name: NormalizedName) -> dict[str, Any]:
     → 155│         data = self._get(f"pypi/{name}/json")
       156│         if data is None:
       157│             raise PackageNotFound(f"Package [{name}] not found.")

  14  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/repositories/pypi_repository.py:241 in _get
       239│     def _get(self, endpoint: str) -> dict[str, Any] | None:
       240│         try:
     → 241│             json_response = self.session.get(
       242│                 self._base_url + endpoint,
       243│                 raise_for_status=False,

  13  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/authenticator.py:246 in get
       244│ 
       245│     def get(self, url: str, **kwargs: Any) -> requests.Response:
     → 246│         return self.request("get", url, **kwargs)
       247│ 
       248│     def post(self, url: str, **kwargs: Any) -> requests.Response:

  12  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/authenticator.py:187 in request
       185│     ) -> requests.Response:
       186│         request = requests.Request(method, url)
     → 187│         credential = self.get_credentials_for_url(url)
       188│ 
       189│         if credential.username is not None or credential.password is not None:

  11  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/authenticator.py:310 in get_credentials_for_url
       308│                 # no credentials were provided in the url, try finding the
       309│                 # best repository configuration
     → 310│                 self._credentials[url] = self._get_credentials_for_url(url)
       311│             else:
       312│                 # Split from the right because that's how urllib.parse.urlsplit()

  10  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/authenticator.py:271 in _get_credentials_for_url
       269│ 
       270│         credential = (
     → 271│             self._get_credentials_for_repository(repository=repository)
       272│             if repository is not None
       273│             else HTTPAuthCredential()

   9  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/authenticator.py:259 in _get_credentials_for_repository
       257│ 
       258│         if key not in self._credentials:
     → 259│             self._credentials[key] = repository.get_http_credentials(
       260│                 password_manager=self._password_manager, username=username
       261│             )

   8  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/authenticator.py:90 in get_http_credentials
        88│         if credential.password is None:
        89│             # fallback to url and netloc based keyring entries
     →  90│             credential = password_manager.keyring.get_credential(
        91│                 self.url, self.netloc, username=credential.username
        92│             )

   7  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/poetry/utils/password_manager.py:51 in get_credential
        49│ 
        50│         for name in names:
     →  51│             credential = keyring.get_credential(name, username)
        52│             if credential:
        53│                 return HTTPAuthCredential(

   6  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/keyring/core.py:72 in get_credential
        70│ ) -> typing.Optional[credentials.Credential]:
        71│     """Get a Credential for the specified service."""
     →  72│     return get_keyring().get_credential(service_name, username)
        73│ 
        74│ 

   5  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/keyring/backends/SecretService.py:113 in get_credential
       111│         scheme = self.schemes[self.scheme]
       112│         query = self._query(service, username)
     → 113│         collection = self.get_preferred_collection()
       114│ 
       115│         with closing(collection.connection):

   4  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/keyring/backends/SecretService.py:62 in get_preferred_collection
        60│                 collection = secretstorage.Collection(bus, self.preferred_collection)
        61│             else:
     →  62│                 collection = secretstorage.get_default_collection(bus)
        63│         except exceptions.SecretStorageException as e:
        64│             raise InitError("Failed to create the collection: %s." % e)

   3  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/collection.py:177 in get_default_collection
       175│     creates it."""
       176│     try:
     → 177│         return Collection(connection)
       178│     except ItemNotFoundException:
       179│         return create_collection(connection, 'Default', 'default', session)

   2  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/collection.py:45 in __init__
        43│         self._collection = DBusAddressWrapper(
        44│             collection_path, COLLECTION_IFACE, connection)
     →  45│         self._collection.get_property('Label')
        46│ 
        47│     def is_locked(self) -> bool:

   1  ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:67 in get_property
        65│     def get_property(self, name: str) -> Any:
        66│         msg = Properties(self).get(name)
     →  67│         (signature, value), = self.send_and_get_reply(msg)
        68│         return value
        69│ 

  DBusErrorResponse

  [org.freedesktop.DBus.Error.UnknownObject] ("No such object path '/org/freedesktop/secrets/aliases/default'",)

  at ~/.local/share/pypoetry/venv/lib/python3.10/site-packages/secretstorage/util.py:48 in send_and_get_reply
       44│     def send_and_get_reply(self, msg: Message) -> Any:
       45│         try:
       46│             resp_msg: Message = self._connection.send_and_get_reply(msg)
       47│             if resp_msg.header.message_type == MessageType.error:
    →  48│                 raise DBusErrorResponse(resp_msg)
       49│             return resp_msg.body
       50│         except DBusErrorResponse as resp:
       51│             if resp.name in (DBUS_UNKNOWN_METHOD, DBUS_NO_SUCH_OBJECT):
       52│                 raise ItemNotFoundException('Item does not exist!') from resp

For completeness this is my poetry config. No matter the value of experimental.system-git-client the end result is the same.

❯ poetry config --list
cache-dir = "/home/user/.cache/pypoetry"
experimental.new-installer = true
experimental.system-git-client = false
installer.max-workers = null
installer.no-binary = null
installer.parallel = true
virtualenvs.create = true
virtualenvs.in-project = null
virtualenvs.options.always-copy = false
virtualenvs.options.no-pip = false
virtualenvs.options.no-setuptools = false
virtualenvs.options.system-site-packages = false
virtualenvs.path = "{cache-dir}/virtualenvs"  # /home/seth/.cache/pypoetry/virtualenvs
virtualenvs.prefer-active-python = false
virtualenvs.prompt = "{project_name}-py{python_version}"
@miquecg miquecg added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Sep 7, 2022
@neersighted
Copy link
Member

Duplicate #1917

@neersighted neersighted closed this as not planned Won't fix, can't repro, duplicate, stale Sep 7, 2022
@neersighted neersighted added status/duplicate Duplicate issues and removed status/triage This issue needs to be triaged labels Sep 7, 2022
@billalive
Copy link

Thanks for the prompt reply @neersighted ! I ran into this as well. The fix in #1917 worked for me.

I don't need the keyring for the project I'm working on this morning, so I can disable the keyring by setting the environment variable. For example, to run poetry update:

PYTHON_KEYRING_BACKEND=keyring.backends.null.Keyring poetry update

@miquecg , #1917 also has a system-wide fix, if you won't need the keyring for any of your poetry projects.

@miquecg
Copy link
Author

miquecg commented Sep 8, 2022

Thx @billalive. Fix worked like a charm.

Copy link

github-actions bot commented Mar 1, 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 1, 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 status/duplicate Duplicate issues
Projects
None yet
Development

No branches or pull requests

3 participants