facelessuser / Rummage

Rummage is a GUI for grep like searches in Python
https://facelessuser.github.io/Rummage/
MIT License
75 stars 10 forks source link

Installation on Ubuntu 24.04 #460

Closed sojusnik closed 4 months ago

sojusnik commented 4 months ago

According to here, it was enough to do the following to install Rummage on Ubuntu 23.10:

sudo apt install python3-wxgtk4.0 python3-wxgtk-webview4.0 pipx install --system-site-packages rummage

but when doing so on Ubuntu 24.04 you'll get:

$ pipx install --system-site-packages rummage
Fatal error from pip prevented installation. Full pip output in file:
    /home/sojusnik/.local/pipx/logs/cmd_2024-05-11_16.22.12_pip_errors.log

pip seemed to fail to build package:
    rummage

Some possibly relevant errors from pip install:
    error: subprocess-exited-with-error
    ModuleNotFoundError: No module named 'setuptools'
    ModuleNotFoundError: No module named 'distutils'
    error: metadata-generation-failed

Error installing rummage.

/home/sojusnik/.local/pipx/logs/cmd_2024-05-11_16.22.12_pip_errors.log:

PIP STDOUT
----------
Collecting rummage
  Using cached rummage-4.20.2.tar.gz (8.5 MB)
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Installing backend dependencies: started
  Installing backend dependencies: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'error'

PIP STDERR
----------
WARNING: Skipping /usr/lib/python3.12/dist-packages/argcomplete-3.1.4.dist-info due to invalid metadata entry 'name'
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [28 lines of output]
      Traceback (most recent call last):
        File "/tmp/pip-build-env-17h83r5l/normal/lib/python3.12/site-packages/babel/messages/setuptools_frontend.py", line 7, in <module>
          from setuptools import Command
      ModuleNotFoundError: No module named 'setuptools'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/home/sojusnik/.local/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/home/sojusnik/.local/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/sojusnik/.local/pipx/shared/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 152, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
                         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-17h83r5l/overlay/lib/python3.12/site-packages/hatchling/build.py", line 58, in build_wheel
          return os.path.basename(next(builder.build(directory=wheel_directory, versions=['standard'])))
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-17h83r5l/overlay/lib/python3.12/site-packages/hatchling/builders/plugin/interface.py", line 147, in build
          build_hook.initialize(version, build_data)
        File "/tmp/pip-install-se3a0_so/rummage_d1895c1ae51e4eed8dacadcbdd155a67/hatch_build.py", line 71, in initialize
          from babel.messages.frontend import compile_catalog
        File "/tmp/pip-build-env-17h83r5l/normal/lib/python3.12/site-packages/babel/messages/frontend.py", line 1121, in __getattr__
          from babel.messages import setuptools_frontend
        File "/tmp/pip-build-env-17h83r5l/normal/lib/python3.12/site-packages/babel/messages/setuptools_frontend.py", line 15, in <module>
          from distutils.cmd import Command
      ModuleNotFoundError: No module named 'distutils'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

What could be the problem?

facelessuser commented 4 months ago

You can try installing setuptools and possibly distutils if required. Keep in mind also that Rummage is not yet supported on Python 3.12 officially due to wxPython still not having a proper Python 3.12 release.

sojusnik commented 4 months ago

python3-setuptools and python3-setuptools-whl were already installed, but even after installing python3-distutils-extra I get the same error message.

facelessuser commented 4 months ago

Unfortunately, we don't have a wxPython release that doesn't segfault on 3.12 (on some platforms), so Rummage does not yet support 3.12, formally. This makes this a little bit of a lower-priority item until 3.12 is generally supported by Rummage. Python 3.12 support requires wxPython to finally make a release with the needed fix. They are long overdue for a release.

It appears this issue is likely an environmental issue. I'm not sure if Ubuntu changed something yet again or if this is specific to some Python 3.12 change. Maybe you need to remove your virtual environment install setuptools and then recreate it (I have no idea what you've done, so ignore if you have already tried this). I don't think it is Python 3.12 related as I can run and install Rummage with Python 3.12 on mac, but it will segfault on close.

Anyway, when I get some time, I will take a look. I'll have to set up a 24.04 environment. Linux systems have really made this process more convoluted.

toxpal commented 4 months ago

I have the same problem after upgrading Manjaro KDE (which now uses Plasma 6 instead of 5). System claims rummage is not installed and installing it doesn't work because of this error:

File "/tmp/pip-build-env-p84w2_0j/normal/lib/python3.12/site-packages/babel/messages/setuptools_frontend.py", line 7, in <module> from setuptools import Command ModuleNotFoundError: No module named 'setuptools'

Uninstalling/re-installing setuptools have no effect...

facelessuser commented 4 months ago

When I get a chance, I can see if I can work through the setuptools issue. This is currently required by babel. Hopefully it is easy enough to work through.

Babel is needed for localization, but to be honest, we only have an outdated Russian localization, and the original committer has moved on. I don't know of anyone else that using localization as there are no other official localizations in our repository.

facelessuser commented 4 months ago

This is confusing because the pybabel command, which we use, is supposed to be decoupled from setuptools/distutils now: https://github.com/python-babel/babel/releases/tag/v2.14.0. I'm not sure why it is still attempting to be installed.

toxpal commented 4 months ago

I also tried re-installing babel, installing it as system-wide package, no luck... Rummage refuses to be installed because of babel/setuptools error...

facelessuser commented 4 months ago

I think I know what needs to be done. The custom hook I think now needs the dependency: "setuptools; python_version >= '3.12'",. I'll get a PR up this evening, then people can test installing Rummage directly from the PR to see if it resolves the issue.

facelessuser commented 4 months ago

PR is up https://github.com/facelessuser/Rummage/pull/461. I'd be interested to see if someone can point at it instead and see if it resolves the issue.

toxpal commented 4 months ago

Unfortunately, I have not much experience with python (I can only install rummage as explained in the docs, and this is it), so hopefully someone will be able to check that PR

facelessuser commented 4 months ago

You would just point to the repo instead of rummage.

python3.12 -m pip install git+https://github.com/facelessuser/Rummage.git@bugfix/babel
facelessuser commented 4 months ago

This assumes you have git installed

facelessuser commented 4 months ago

The fix seems to work:

Screenshot 2024-05-14 at 9 29 10 AM
facelessuser commented 4 months ago

Keep in mind, if you experience any issues on Python 3.12, it is not currently supported. Issues I've seem may be confined to mac though, so maybe Linux and Windows is fine.

facelessuser commented 4 months ago

I've tagged a release which should be available soon-ish.

toxpal commented 4 months ago

I run Python 3.12 and just installed 4.20.3 - works great on Manjaro Linux, no more Babel errors. Thank you for your super-fast responses.

Offtopic, I'd like to donate to you again. Is there any possibility I can send some money (let's say 100 EUR) to you directly and get some kind of invoice (it can say software, services, whatever)? Github only allows paying by invoice for large companies and minimum invoice amount is 5000 USD :/ https://docs.github.com/en/sponsors/sponsoring-open-source-contributors/paying-for-github-sponsors-by-invoice

facelessuser commented 4 months ago

@toxpal I think I can issue invoices through PayPal. You can contact me directly and we can try to work this out if you are interested. As I've never done this before I'm a little uncertain of the flow.