LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 05-24-2024, 02:35 PM   #1
rinza
Member
 
Registered: Feb 2021
Distribution: Slackware64-current / Plasma
Posts: 56

Rep: Reputation: 10
Deluge again: stopped working after python-setuptools-70.0.0 upgrade on -current


Hi! After upgrading python-setuptools-70.0.0 deluge fails with the following:

Code:
NameError: name '_read_utf8_with_fallback' is not defined
I checked and the function is present, defined at

Code:
python-setuptools-70.0.0-x86_64-1:usr/lib/python3.11/site-packages/setuptools/unicode_utils.py
Tried to reinstall setuptools, recompile Deluge and all its (non-shipped with Slackware) python dependencies and the problem persists. I wonder if this has something to do with the precompiled binary of unicode_utils at setuptools' __pycache__ shipped with the package, or if this is a problem with Deluge code itself. Any insight would be appreciated, thanks!

Edit: I'm using Deluge bleeding edge, something like 2.1.1.dev99/2.1.2.dev0, cloned from their github repository, but that is the version that was working before setuptools upgrade.

Last edited by rinza; 05-24-2024 at 02:42 PM.
 
Old 05-24-2024, 02:53 PM   #2
rinza
Member
 
Registered: Feb 2021
Distribution: Slackware64-current / Plasma
Posts: 56

Original Poster
Rep: Reputation: 10
Ok, by running the Python console I tried to invoke the function

Code:
>>> from setuptools.unicode_utils import _read_utf8_with_fallback
>>> _read_utf8_with_fallback("/tmp/test.txt")
and it does return the .txt content correctly. So the problem lies somewhere else, maybe?

Here is the full error message, it does seem to come from python setuptools itself not Deluge code, but I'm not sure:

Code:
Traceback (most recent call last):
  File "/usr/bin/deluge-gtk", line 33, in <module>
    sys.exit(load_entry_point('deluge==2.1.1.dev99', 'gui_scripts', 'deluge-gtk')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/deluge/ui/gtk3/__init__.py", line 63, in start
    Gtk().start()
  File "/usr/lib/python3.11/site-packages/deluge/ui/gtk3/__init__.py", line 44, in start
    from .gtkui import GtkUI
  File "/usr/lib/python3.11/site-packages/deluge/ui/gtk3/gtkui.py", line 61, in <module>
    from .pluginmanager import PluginManager
  File "/usr/lib/python3.11/site-packages/deluge/ui/gtk3/pluginmanager.py", line 12, in <module>
    import deluge.pluginmanagerbase
  File "/usr/lib/python3.11/site-packages/deluge/pluginmanagerbase.py", line 15, in <module>
    import pkg_resources
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 3282, in <module>
    @_call_aside
     ^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 3266, in _call_aside
    f(*args, **kwargs)
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 3295, in _initialize_master_working_set
    working_set = _declare_state('object', 'working_set', WorkingSet._build_master())
                                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 589, in _build_master
    ws.require(__requires__)
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 926, in require
    needed = self.resolve(parse_requirements(requirements))
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 787, in resolve
    dist = self._resolve_dist(
           ^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 816, in _resolve_dist
    env = Environment(self.entries)
          ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 1014, in __init__
    self.scan(search_path)
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 1046, in scan
    for dist in find_distributions(item):
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2091, in find_on_path
    yield from factory(fullpath)
               ^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2183, in resolve_egg_link
    return next(dist_groups, ())
           ^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2179, in <genexpr>
    resolved_paths = (
                     ^
  File "/usr/lib/python3.11/site-packages/pkg_resources/__init__.py", line 2167, in non_empty_lines
    for line in _read_utf8_with_fallback(path).splitlines():
                ^^^^^^^^^^^^^^^^^^^^^^^^
NameError: name '_read_utf8_with_fallback' is not defined

Last edited by rinza; 05-24-2024 at 03:31 PM.
 
Old 05-26-2024, 06:06 AM   #3
rinza
Member
 
Registered: Feb 2021
Distribution: Slackware64-current / Plasma
Posts: 56

Original Poster
Rep: Reputation: 10
Apparently this is a problem with Setuptools v70. A temporary (extreme) fix is editing /usr/lib/python3.11/site-packages/pkg_resources/__init__.py and moving the following lines to the head of the file, right bellow the imports declarations (around line 87).

Code:
#  ---- Ported from ``setuptools`` to avoid introducing an import inter-dependency ----
LOCALE_ENCODING = "locale" if sys.version_info >= (3, 10) else None

def _read_utf8_with_fallback(file: str, fallback_encoding=LOCALE_ENCODING) -> str:
    """See setuptools.unicode_utils._read_utf8_with_fallback"""
    try:
        with open(file, "r", encoding="utf-8") as f:
            return f.read()
    except UnicodeDecodeError:  # pragma: no cover
        msg = f"""\
        ********************************************************************************
        `encoding="utf-8"` fails with {file!r}, trying `encoding={fallback_encoding!r}`.

        This fallback behaviour is considered **deprecated** and future versions of
        `setuptools/pkg_resources` may not implement it.

        Please encode {file!r} with "utf-8" to ensure future builds will succeed.

        If this file was produced by `setuptools` itself, cleaning up the cached files
        and re-building/re-installing the package with a newer version of `setuptools`
        (e.g. by updating `build-system.requires` in its `pyproject.toml`)
        might solve the problem.
        ********************************************************************************
        """
        # TODO: Add a deadline?
        #       See comment in setuptools.unicode_utils._Utf8EncodingNeeded
        warnings.warn(msg, PkgResourcesDeprecationWarning, stacklevel=2)
        with open(file, "r", encoding=fallback_encoding) as f:
            return f.read()
 
Old 06-19-2024, 11:01 AM   #4
rinza
Member
 
Registered: Feb 2021
Distribution: Slackware64-current / Plasma
Posts: 56

Original Poster
Rep: Reputation: 10
This problem is fixed now with the new setuptools-70.1.0
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
deluge-web cannot connect to the deluge domain deluged? shams Ubuntu 1 08-05-2019 05:42 AM
deluge-web cannot connect to the deluge domain deluged? shams Ubuntu 0 07-27-2019 09:45 AM
-current, bug in the SlackBuild for python-setuptools-40.2.0-x86_64-1.txz NausX Slackware 7 09-13-2018 06:41 PM
[SOLVED] Slackware current - Openssl and python2 update broke python-setuptools? orbea Slackware 28 03-14-2016 03:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 02:12 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration