Yubico / yubikey-manager-qt

Cross-platform application for configuring any YubiKey over all USB interfaces.
https://developers.yubico.com/yubikey-manager-qt/
BSD 2-Clause "Simplified" License
237 stars 30 forks source link

ImportError with ykman 5.0.0 #328

Open AidanGG opened 1 year ago

AidanGG commented 1 year ago

Steps to reproduce

Install ykman 5.0.0, then run ykman-gui --log-level DEBUG. Receive error: ImportError: cannot import name 'connect_to_device' from 'ykman' (/usr/lib/python3.10/site-packages/ykman/__init__.py)

The GUI does appear, but no YubiKeys are detected.

Expected result

The YubiKeys are detected, and the manager functions as normal.

Additional Info

Works with ykman 4.0.9, the version prior to the update to 5.0.0 on Arch Linux.

dainnilsson commented 1 year ago

The ykman CLI project uses semantic versioning, and the major number increase from 4 to 5 signals backwards incompatible changes. yubikey-manager-qt requires ykman 4.x. and any packaging of the yubikey-manager-qt needs to ensure this.

gbcox commented 1 year ago

Any idea when this will be upgraded for ykman 5. This will be another blocker for Fedora.

IPlayZed commented 1 year ago

Hi, I can confirm that on Arch the Qt apps are broken.

My relevant logs are:

Oct 29 18:18:08 archpc yubioath-desktop[5437]: "PyOtherSide error: Traceback (most recent call last):\n\n  File \"qrc:///py/yubikey.py\", line 23, in <module>\n    from ykman.device import scan_devices, list_all_devices, connect_to_device, get_name, read_info\n\nImportError: cannot import name 'connect_to_device' from 'ykman.device' (/usr/lib/python3.10/site-packages/ykman/device.py)\n"
Oct 29 18:18:08 archpc yubioath-desktop[5437]: Unhandled PyOtherSide error: Cannot import module: yubikey (Traceback (most recent call last):

                                                 File "qrc:///py/yubikey.py", line 23, in <module>
                                                   from ykman.device import scan_devices, list_all_devices, connect_to_device, get_name, read_info

                                               ImportError: cannot import name 'connect_to_device' from 'ykman.device' (/usr/lib/python3.10/site-packages/ykman/device.py)
                                               )
Oct 29 18:18:08 archpc yubioath-desktop[5437]: "PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'yubikey' is not defined\n"
Oct 29 18:18:08 archpc yubioath-desktop[5437]: Unhandled PyOtherSide error: Function not found: 'yubikey.init' (Traceback (most recent call last):

                                                 File "<string>", line 1, in <module>

                                               NameError: name 'yubikey' is not defined
                                               )
Oct 29 18:18:08 archpc yubioath-desktop[5437]: "PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'yubikey' is not defined\n"
Oct 29 18:18:08 archpc yubioath-desktop[5437]: Unhandled PyOtherSide error: Function not found: 'yubikey.controller.check_descriptors' (Traceback (most recent call last):

                                                 File "<string>", line 1, in <module>

                                               NameError: name 'yubikey' is not defined
                                               )
Oct 29 18:18:08 archpc yubioath-desktop[5437]: qml: TypeError: Cannot read property 'success' of undefined undefined
Oct 29 18:18:08 archpc yubioath-desktop[5437]: "PyOtherSide error: Traceback (most recent call last):\n\n  File \"<string>\", line 1, in <module>\n\nNameError: name 'yubikey' is not defined\n"
Oct 29 18:18:08 archpc yubioath-desktop[5437]: Unhandled PyOtherSide error: Function not found: 'yubikey.controller.is_win_non_admin' (Traceback (most recent call last):

                                                 File "<string>", line 1, in <module>

                                               NameError: name 'yubikey' is not defined
                                               )

This breaks yubikey-manager as well. It seems like the core problem is that the correct Python module can not be imported: Unhandled PyOtherSide error: Cannot import module: yubikey My relevant package versions are:

yubico-c 1.13-6
yubico-c-client 2.15-5
yubico-pam 2.27-2
yubikey-full-disk-encryption r150.2c5fdf3-1
yubikey-manager 5.0.0-1
yubikey-manager-qt 1.2.4-1
yubikey-personalization 1.20.0-3
yubikey-personalization-gui 3.1.25-2
python 3.10.8-2
IPlayZed commented 1 year ago

Seems to be the same thing as #320 .

AidanGG commented 1 year ago

320 occurs from misconfiguration of the Python environment, this issue occurs because of the incompatibility with the newly released ykman 5.

dainnilsson commented 1 year ago

Any idea when this will be upgraded for ykman 5. This will be another blocker for Fedora.

Unfortunately I don't have a date for that, nothing scheduled right now. If I were to make a guess I'd say sometime in Q1 of next year, but don't hold me to that!

vbrandl commented 1 year ago

While it doesn't solve the actual problem, creating a python virtual environment, installing yubikey-manager 4 and starting ykman-gui inside that environment, works for now:

python -m venv .venv
source .venv/bin/activate
pip install yubikey-manager==4.0.9

For now I use the following script inside the venv to start ykman-gui:

#!/usr/bin/bash

source .venv/bin/activate
ykman-gui
deactivate
vbrandl commented 1 year ago

Looking at https://github.com/archlinux/svntogit-community/commits/packages/yubikey-manager/trunk, Arch Linux downgraded the yubikey-manager package back to 4.0.9. This should fix the problem for Arch based distros for now.

fdennis commented 1 year ago

Hello, 1.2.5 has just been released and is compatible with ykman 5.0.1.

IPlayZed commented 3 months ago

This issue should be closed as far as I understand.