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

ulauncher fails to launch with system upgrade to python 3.12.0 on Void Linux #1282

Open
2 of 3 tasks
lee2sman opened this issue Oct 10, 2023 · 11 comments
Open
2 of 3 tasks
Labels

Comments

@lee2sman
Copy link

lee2sman commented Oct 10, 2023

Environment

Void Linux, i3

Bug description

Hi, I'm on Void linux and did our regular package update, which upgraded python3 to 3.12.0. I have the python3-Levenshtein-0.12.0_9 package installed. Unfortunately, now ulauncher fails to load. Suggestions for how I can fix this?

Log output

Traceback (most recent call last):
  File "/usr/bin/ulauncher", line 27, in <module>
    from ulauncher.main import main
  File "/usr/lib/python3.12/site-packages/ulauncher/main.py", line 25, in <module>
    from ulauncher.ui.windows.UlauncherWindow import UlauncherWindow
  File "/usr/lib/python3.12/site-packages/ulauncher/ui/windows/UlauncherWindow.py", line 23, in <module>
    from ulauncher.search.Search import Search
  File "/usr/lib/python3.12/site-packages/ulauncher/search/Search.py", line 3, in <module>
    from ulauncher.api.server.ExtensionSearchMode import ExtensionSearchMode
  File "/usr/lib/python3.12/site-packages/ulauncher/api/server/ExtensionSearchMode.py", line 3, in <module>
    from ulauncher.api.server.DeferredResultRenderer import DeferredResultRenderer
  File "/usr/lib/python3.12/site-packages/ulauncher/api/server/DeferredResultRenderer.py", line 11, in <module>
    from ulauncher.api.shared.item.ResultItem import ResultItem
  File "/usr/lib/python3.12/site-packages/ulauncher/api/shared/item/ResultItem.py", line 5, in <module>
    from ulauncher.utils.text_highlighter import highlight_text
  File "/usr/lib/python3.12/site-packages/ulauncher/utils/text_highlighter.py", line 1, in <module>
    from ulauncher.utils.fuzzy_search import get_matching_indexes
  File "/usr/lib/python3.12/site-packages/ulauncher/utils/fuzzy_search.py", line 4, in <module>
    from Levenshtein import distance
  File "/usr/lib/python3.12/site-packages/Levenshtein/__init__.py", line 1, in <module>
    from Levenshtein import _levenshtein
ImportError: /usr/lib/python3.12/site-packages/Levenshtein/_levenshtein.so: undefined symbol: PyUnicode_AS_UNICODE

Communication guidelines

  • I have read and agree with Ulauncher's communication guidelines and checked the troubleshooting page for self-help.

Not an extension issue

  • This issue applies to the Ulauncher application, not a specific extension.

Ulauncher v6

  • I have made sure the bug isn't already fixed in v6.
@lee2sman lee2sman added the bug label Oct 10, 2023
@friday
Copy link
Member

friday commented Oct 11, 2023

Thanks for the update. Python 3.12 removed distutils. We are planning to release Ulauncher v6 to solve this. It's been in the work for years and it was rewritten not to use distutils 2 years ago. I don't know how to build a package for Void Linux, but maybe you can run it from the working branch or build a package from it in the meanwhile? https://github.com/Ulauncher/Ulauncher/blob/v6/CONTRIBUTING.md.

@lee2sman
Copy link
Author

Thanks,i installed the dependencies and then i tried to run ./bin/ulauncher -v and get this error:

Traceback (most recent call last):
  File "/home/void/Software/Ulauncher/./bin/ulauncher", line 28, in <module>
    from ulauncher.main import main
  File "/home/void/Software/Ulauncher/ulauncher/main.py", line 11, in <module>
    import ulauncher.utils.xinit  # noqa: F401
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/void/Software/Ulauncher/ulauncher/utils/xinit.py", line 4, in <module>
    from ulauncher.utils.environment import IS_X11_COMPATIBLE
  File "/home/void/Software/Ulauncher/ulauncher/utils/environment.py", line 13, in <module>
    os_release = dict(reader)
                 ^^^^^^^^^^^^
ValueError: dictionary update sequence element #7 has length 0; 2 is required

@lee2sman
Copy link
Author

Hi again, I'm back. I wasn't able to get v6.0 install to run, but got some help from the void linux devteam to get 5 running.

python3 -m venv /path/to/venv --system-site-packages
path/to/venv install levenshtein

Then to launch:

path/to/venv/bin/python /usr/bin/ulauncher

I also placed this in my i3 config:

exec --no-startup-id /path/to/venv/bin/python /usr/bin/ulauncher --no-window

which allows it to autostart (for whatever reason, the search window automatically opens. i wasn't able to figure out how to autostart without the launcher window opening. but in any case, i'm back to things working again. thanks. feel free to close this if it's out of scope to work on this for v5 with python 3.12.0

@friday
Copy link
Member

friday commented Oct 15, 2023

Finally had some time to dedicate to Ulauncher again.

First off, if there's something we can do to make Ulauncher run better for Void Linux we're happy to do that, but we don't have the time to officially support and test for Void, and we all uses systemd. But I think it'd be good to keep this issue open until we can support void without workarounds or have documented the workarounds.

I fixed the "ValueError: dictionary update sequence element #7 has length 0; 2 is required" issue 29f74ab, so maybe you can get v6 to run with that.

Also, while we say python-levenshtein is required, it's actually not any more in v6, but the native python library we fallback on is much slower if you try to search through a lot of entries. So we still put python-levenshtein in as a dependency.

@krendil
Copy link

krendil commented Oct 15, 2023

@lee2sman Thanks for the workaround to get V5 working on Void. In order to get the search window not to show automatically, I believe the argument is --hide-window, not --no-window

@friday
Copy link
Member

friday commented Oct 15, 2023

Oh yeah, I didn't spot that. It's --no-window in v6 and --hide-window in v5.

@lee2sman lee2sman changed the title ulauncher fails to launch with system upgrade to python 3.12.0 ulauncher fails to launch with system upgrade to python 3.12.0 on Void Linux Oct 16, 2023
@lee2sman
Copy link
Author

lee2sman commented Oct 16, 2023

Hi folks, thanks so much for your work on this. I just wanted to confirm that I've pulled your changes and now ulauncher v6 does build and run as well! Thanks so much.

I'm running Ulauncher version 6.0.0-beta1 with GTK. I do get a ⚠️ WARNING systemctl command missing systemd_controller.can_start:24 because void uses runit not systemd, as you mentioned, but the program works fine.

And thanks for the tip on --no-window vs --hide-window.

If I try to run v6 outside of the ulauncher directory, ulauncher won't run and throws the error setup.py not found

Traceback (most recent call last):
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 156, in save_modules
    yield saved
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 198, in setup_context
    yield
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 259, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 41, in _execfile
    with open(filename, mode) as stream:
         ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 455, in _open
    return _open(path, mode, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'setup.py'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/void/Software/Ulauncher/bin/ulauncher", line 45, in <module>
    main(IS_DEV)
  File "/home/void/Software/Ulauncher/ulauncher/main.py", line 45, in main
    sandbox.run_setup("setup.py", ["build_prefs"])
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 249, in run_setup
    with setup_context(setup_dir):
  File "/usr/lib/python3.12/contextlib.py", line 155, in __exit__
    self.gen.throw(value)
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 190, in setup_context
    with save_modules():
  File "/usr/lib/python3.12/contextlib.py", line 155, in __exit__
    self.gen.throw(value)
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 169, in save_modules
    saved_exc.resume()
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 143, in resume
    raise exc.with_traceback(self._tb)
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 156, in save_modules
    yield saved
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 198, in setup_context
    yield
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 259, in run_setup
    _execfile(setup_script, ns)
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 41, in _execfile
    with open(filename, mode) as stream:
         ^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.12/site-packages/setuptools/sandbox.py", line 455, in _open
    return _open(path, mode, *args, **kw)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'setup.py'

@lee2sman
Copy link
Author

also FYI: v6 throws this warning when I run --version. But I don't expect you to have to debug Void-specific things.

Your system does not support launching applications in isolated scopes.
This may result in applications launched by Ulauncher to depend on the main
process (Ulauncher) and forced to exit prematurely if Ulauncher exits or crashes.
Most likely this is caused by using an outdated or or misconfigured system.

@friday
Copy link
Member

friday commented Oct 16, 2023

If I try to run v6 outside of the ulauncher directory, ulauncher won't run and throws the error setup.py not found

Yeah, that's because you need to either have the ulauncher module installed for your system python version, or your working directory needs to be the project root and run in dev mode.

The latter systemd warning exists specifically because of #991 (comment). I would think this does still apply to you, so the warning should remain. If you kill Ulauncher, do the apps launched with Ulauncher get killed as well? Does runit have an equivalent to systemd-run --user --scope?

@lee2sman
Copy link
Author

lee2sman commented Oct 16, 2023

Bare with me, I'm not a runit expert. But thankfully runit it is pretty easy and doesn't take much for me to work with it.
The v5 ulauncher version does not throw this warning. It's only the v6 version that gives this warning. I've not had ulauncher crash and in void with i3 i'm running it without a startup id so i'm not sure how to test killing it to see if ulauncher apps crash in that case. i'd guess not since it's never happened to me?

@lee2sman
Copy link
Author

v6 doesn't run with the system python version. And i want ulauncher to run at startup, which can't assume i'm inside the ulauncher project root, so i'm going to be sticking with running v5 then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants