requestsync fails with ModuleNotFoundError: No module named 'keyring' error

Bug #2049217 reported by Neil Wilson
26
This bug affects 3 people
Affects Status Importance Assigned to Milestone
python-launchpadlib (Ubuntu)
Fix Released
Undecided
Unassigned
ubuntu-dev-tools (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

Ubuntu Noble

requestsync has started failing on this version of Ubuntu

$ requestsync mkosi
Traceback (most recent call last):
  File "/usr/bin/requestsync", line 402, in <module>
    main()
  File "/usr/bin/requestsync", line 187, in main
    Launchpad.login(service=args.lpinstance, api_version="devel")
  File "/usr/lib/python3/dist-packages/ubuntutools/lp/lpapicache.py", line 84, in login
    self.__lp = LP.login_with("ubuntu-dev-tools", service, version=api_version)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 700, in login_with
    return cls._authorize_token_and_login(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/launchpadlib/launchpad.py", line 445, in _authorize_token_and_login
    cached_credentials = credential_store.load(
                         ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 345, in load
    return self.do_load(unique_key)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 423, in do_load
    self._ensure_keyring_imported()
  File "/usr/lib/python3/dist-packages/launchpadlib/credentials.py", line 388, in _ensure_keyring_imported
    import keyring
ModuleNotFoundError: No module named 'keyring'

ProblemType: Bug
DistroRelease: Ubuntu 24.04
Package: ubuntu-dev-tools 0.197
ProcVersionSignature: User Name 6.5.0-9.9-generic 6.5.3
Uname: Linux 6.5.0-9-generic x86_64
ApportVersion: 2.27.0-0ubuntu6
Architecture: amd64
CasperMD5CheckResult: unknown
CloudArchitecture: x86_64
CloudBuildName: server
CloudID: brightbox
CloudName: brightbox
CloudPlatform: ec2
CloudRegion: gb1s-
CloudSerial: 20240104
CloudSubPlatform: metadata (http://169.254.169.254)
Date: Fri Jan 12 16:18:42 2024
PackageArchitecture: all
SourcePackage: ubuntu-dev-tools
UpgradeStatus: No upgrade log present (probably fresh install)

Related branches

Revision history for this message
Neil Wilson (neil-aldur) wrote :
Revision history for this message
Stefano Rivera (stefanor) wrote :

This sounds like a regression from launchpadlib dropping python3-keyring from Recommends to Suggests in https://bugs.debian.org/1056553

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in python-launchpadlib (Ubuntu):
status: New → Confirmed
Changed in ubuntu-dev-tools (Ubuntu):
status: New → Confirmed
Revision history for this message
Alex Murray (alexmurray) wrote :

I just ran into this - so I assume the fix here would be to make launchpadlib Depends on python3-keyring since contrary to the comment in the linked Debian bug, it clearly is not "perfectly usable" without python3-keyring?

Revision history for this message
Chris Peterson (cpete) wrote :

Based on the previous python-launchpadlib depends vs suggests on python3-keyring discussion, I think the correct action here would be to make ubuntu-dev-tools depend on python3-keyring.

Revision history for this message
Alex Murray (alexmurray) wrote :

Isn't this putting the dependency in the wrong place though? The code in requestsync doesn't explicitly do anything that would influence the call to launchpadlib to try and use they keyring module - https://git.launchpad.net/ubuntu-dev-tools/tree/requestsync#n187

So shouldn't then the Depends be in launchpadlib itself since it clearly does depend on this being available?

Revision history for this message
Alex Murray (alexmurray) wrote :

Otherwise every user of python3-launchpadlib will need a Depends on python3-keyring which seems non-intuitive to me.

Revision history for this message
Chris Peterson (cpete) wrote :

>Otherwise every user of python3-launchpadlib will need a Depends on python3-keyring which seems non-intuitive to me.

Agreed. The situation isn't great.

The doc string for the offending function (login_with):

https://git.launchpad.net/ubuntu/+source/python-launchpadlib/tree/src/launchpadlib/launchpad.py#n522

seems to imply this entire function is useless unless invoked on a desktop system. So the commit message saying "perfectly usable" without python3-keyring wasn't correct.

The problem is that making python-launchpadlib Recommend/Depend python3-keyring causes many packages to be installed on systems that don't need them (i.e. server), which is I think is worse than requiring a conditional install of another package.

I think in the ideal scenario the two use cases for python-launchpadlib would be split into two packages (desktop/non-desktop).

Revision history for this message
Stefano Rivera (stefanor) wrote :

> I think in the ideal scenario the two use cases for python-launchpadlib would be split into two packages (desktop/non-desktop).

Yes, probably. Standard automatic dh_python3 dependencies won't handle that situation, they'll need to be manually specified in client packages.

python3-launchpadlib-desktop would be an empty package that Depends: python3-launchpadlib, python3-keyring.

Revision history for this message
Chris Peterson (cpete) wrote :

That sounds like something reasonable we could do now to alleviate the issue.

The list of reverse-depends for python-launchpadlib isn't very big and the set that would need transitioning to the new package is even smaller (ubuntu-dev-tools, lptools, unity-scope-launchpad, lubuntu-desktop, and maybe python3-breezy at first glance).

I think the only hiccup is that it would have to be a Universe package since python3-keyring is in Universe (this only recently changed in Noble but I haven't looked in to why yet. Perhaps because of python-launchpadlib dropping it?) whereas python-launchpadlib is in Main.

If this is fine, I'm happy to work on this. What do you think?

Revision history for this message
Stefano Rivera (stefanor) wrote :
Revision history for this message
Chris Peterson (cpete) wrote (last edit ):

MP to change Depends:python3-launchpadlib to Depends:python3-launchpadlib-desktop in ubuntu-dev-tools: https://code.launchpad.net/~cpete/ubuntu-dev-tools/+git/ubuntu-dev-tools/+merge/461309

Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package python-launchpadlib - 1.11.0-6

---------------
python-launchpadlib (1.11.0-6) unstable; urgency=medium

  * Correct mistake in user unit.

 -- Stefano Rivera <email address hidden> Sat, 24 Feb 2024 19:33:49 -0400

Changed in python-launchpadlib (Ubuntu):
status: Confirmed → Fix Released
Revision history for this message
Andreas Hasenack (ahasenack) wrote :

Asked some "procedure" questions in the MP.

Changed in ubuntu-dev-tools (Ubuntu):
status: Confirmed → Incomplete
Revision history for this message
Chris Peterson (cpete) wrote :

Thanks for the feedback Andreas. I left some comments on the MP, but I wanted to comment here too for visibility. Perhaps I made things confusing trying to fix the situation in upstream only. If it's easier/better this way, I've attached a minimal diff that will provide the changes needed to fix the package right now and then we can discard the delta once the upstream changes have been made later.

Changed in ubuntu-dev-tools (Ubuntu):
status: Incomplete → Confirmed
Revision history for this message
Lukas Märdian (slyon) wrote :

The debdiff LGTM. Let's keep the MP open to get it integrated in the upstream repository.

https://launchpad.net/ubuntu/+source/ubuntu-dev-tools/0.201ubuntu1

Changed in ubuntu-dev-tools (Ubuntu):
status: Confirmed → Fix Committed
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package ubuntu-dev-tools - 0.201ubuntu1

---------------
ubuntu-dev-tools (0.201ubuntu1) noble; urgency=medium

  * Replace Depends on python3-launchpadlib with Depends on
    python3-launchpadlib-desktop (LP: #2049217)

 -- Chris Peterson <email address hidden> Fri, 01 Mar 2024 14:08:07 -0800

Changed in ubuntu-dev-tools (Ubuntu):
status: Fix Committed → Fix Released
Revision history for this message
Chris Peterson (cpete) wrote :

Great, thanks Lukas!

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.