[openstackclient] openstack cli broken after update to Wallaby
Clark Boylan
cboylan at sapwetik.org
Wed Apr 5 21:37:45 UTC 2023
On Tue, Apr 4, 2023, at 7:34 AM, Eugen Block wrote:
> Hi *,
>
> today I upgraded my virtual test environment from V to W when (Ubuntu
> 20.04) all of a sudden cli commands didn't work anymore with this
> stack trace:
>
> ---snip---
> root at control01:~# openstack network agent list
> Traceback (most recent call last):
> File "/usr/bin/openstack", line 6, in <module>
> from openstackclient.shell import main
> File "/usr/lib/python3/dist-packages/openstackclient/shell.py",
> line 23, in <module>
> from osc_lib import shell
> File "/usr/lib/python3/dist-packages/osc_lib/shell.py", line 24, in <module>
> from cliff import app
> File "/usr/lib/python3/dist-packages/cliff/app.py", line 22, in <module>
> import cmd2
> File "/usr/lib/python3/dist-packages/cmd2.py", line 585, in <module>
> _ = pyperclip.paste()
> File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line
> 667, in lazy_load_stub_paste
> copy, paste = determine_clipboard()
> File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line
> 558, in determine_clipboard
> return init_gi_clipboard()
> File "/usr/lib/python3/dist-packages/pyperclip/__init__.py", line
> 167, in init_gi_clipboard
> gi.require_version('Gtk', '3.0')
> File "/usr/lib/python3/dist-packages/gi/__init__.py", line 129, in
> require_version
> raise ValueError('Namespace %s not available' % namespace)
> ValueError: Namespace Gtk not available
> ---snip---
>
> I found this bug [1] describing the same issue but there has been no
> progress. I posted my comments there as well. I found one way to get
> the openstack shell to work by installing libgtk-3-dev (I found a hint
> in a search engine). Apparently, python3-cmd2 requires
> python3-pyperclip which requires python3-gi and so on. Is this really
> the desired way? I didn't notice anything in the release notes (maybe
> I missed it). When comparing to a different environment (Victoria on
> baremetal) I see that libgtk-3 is installed there (not -dev though),
> but even with libgtk-3-0 the error message was still present. So the
> question is, which dependencies are missing where? It's not really
> obvious to me. Could this already be fixed in Xena? If it is fixed
> there I could do the double upgrade, of course, especially since
> Wallaby is already under extended maintenance. Any comments are
> appreciated.
I know you've marked this invalid elsewhere, but I think there is an interesting problem somewhere here. In particular I've cloned https://github.com/asweigart/pyperclip which backs the pyperclip pypi package https://pypi.org/project/pyperclip/. Reading determine_clipboard() it seems to do all this extra work (on Linux anyway) if DISPLAY is set. One easy workaround may be to unset that env var in your terminals when running openstackclient.
That said looking more closely init_gi_clipboard() isn't in the current code base. Looking at the history of the project:
`git log -p | grep init_gi_clipboard` produces no results either. This makes me wonder where that is coming from and what version/source of pyperclip you are using. If I grab pyperclip 1.8.2 (which is the upper constraints version for wallaby and xena) from pypi this function doesn't appear to exist there either. It is possible they rewrote their git history at some point, but best I can tell your version of pyperclip doesn't share code or history with the version on pypi specified in upper constraints for wallaby and xena.
Also it looks like if you install xsel or xclip that pyperclip will prefer those tools over the gtk bindings.
>
> Thanks,
> Eugen
>
> [1]
> https://bugs.launchpad.net/ubuntu/+source/python-openstackclient/+bug/1945661
More information about the openstack-discuss
mailing list