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

Rebuild: ModuleNotFoundError: No module named 'zeroconf._utils.ipaddress' #9

Open
macmpi opened this issue Aug 22, 2024 · 7 comments
Open

Comments

@macmpi
Copy link

macmpi commented Aug 22, 2024

Tried prebuilt binary but it failed due to GLib version.

>ldd --version 
ldd (Ubuntu GLIBC 2.31-0ubuntu9.16) 2.31

So tried to rebuild, after installing pymobiledevice3 and adding all deps: resulting binary gives:

>src/dist/ibackep 
Traceback (most recent call last):
  File "main.py", line 2, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 378, in exec_module
  File "ui/app.py", line 5, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 378, in exec_module
  File "pymobiledevice3/lockdown.py", line 25, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 378, in exec_module
  File "pymobiledevice3/bonjour.py", line 8, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 378, in exec_module
  File "zeroconf/__init__.py", line 26, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 378, in exec_module
  File "zeroconf/_core.py", line 32, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 378, in exec_module
  File "zeroconf/_engine.py", line 38, in <module>
  File "src/zeroconf/_listener.py", line 1, in init zeroconf._listener
  File "src/zeroconf/_services/info.py", line 1, in init zeroconf._services.info
ModuleNotFoundError: No module named 'zeroconf._utils.ipaddress'
[PYI-97483:ERROR] Failed to execute script 'main' due to unhandled exception!

I have zeroconf installed:

>pip install zeroconf
Defaulting to user installation because normal site-packages is not writeable
Requirement already satisfied: zeroconf in /home/myuser/.local/lib/python3.8/site-packages (0.132.2)
Requirement already satisfied: async-timeout>=3.0.0 in /home/myuser/.local/lib/python3.8/site-packages (from zeroconf) (4.0.3)
Requirement already satisfied: ifaddr>=0.1.7 in /home/myuser/.local/lib/python3.8/site-packages (from zeroconf) (0.2.0)
WARNING: Error parsing dependencies of python-apt: Invalid version: '2.0.1-elementary11-ubuntu6.1.1'

Maybe a pymobiledevice3-side issue?
Thanks for any thought.

@redromnon
Copy link
Owner

Hi, I've built the binary on my Pop OS 22.04 LTS machine which has glibc version 2.35. I'm aware this will cause issues for users using a distro with an older glib version.

Maybe a pymobiledevice3-side issue?

Honestly, I have no idea why this issue is related to zeroconf. I believe you will have to setup the environment to build from source, until I set up a GitHub action that builds a binary on an older Ubuntu version.

@macmpi
Copy link
Author

macmpi commented Aug 23, 2024

Strange, as baseline pymobiledevice3 CLI seems to just work on my setup...
Maybe linked to flet issue (libmpv.so.1 stuff), as I can't get flet counter.py demo app to run either...
Since app anyway requires zenity, how about a zenity-only UI?

@redromnon
Copy link
Owner

zenity is included in the app (for native folder picker dialog) because Flet uses libmpv.so.1 which is incompatible with most systems.
Also, zenity is useful for simple dialogs and not a full desktop application.

@redromnon
Copy link
Owner

Strange, as baseline pymobiledevice3 CLI seems to just work on my setup...

I don't think it's a pymobobiledevice3 issue. It's a pyinstaller problem, particularly the way it handles app binary packaging, thus causing the glibc error.

@macmpi
Copy link
Author

macmpi commented Aug 23, 2024

Did the hack to circumvent flet libmpv issue, and ran script without compiling.
It went a little further (it did create UI window!) but with red warning on NoneType object attribute as per below:

$ python3 main.py 

** (flet:125970): CRITICAL **: 16:26:41.231: Failed to read XDG desktop portal settings: GDBus.Error:org.freedesktop.portal.Error.NotFound: Requested setting not found
package:media_kit_libs_linux registered.
main.py:26: DeprecationWarning: UserControl is deprecated since version 0.21.0 and will be removed in version 0.26.0. UserControl is deprecated. See https://flet.dev/docs/getting-started/custom-controls.
  ibackep = App()
/home/myuser/Dev/iBackep/src/ui/app.py:14: DeprecationWarning: UserControl is deprecated since version 0.21.0 and will be removed in version 0.26.0. UserControl is deprecated. See https://flet.dev/docs/getting-started/custom-controls.
  self.about_button = About()
Unhandled error processing page session : Traceback (most recent call last):
  File "/home/myuser/.local/lib/python3.8/site-packages/flet_runtime/app.py", line 244, in on_session_created
    await asyncio.get_running_loop().run_in_executor(
  File "/usr/lib/python3.8/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "main.py", line 28, in main
    page.add(ibackep)
  File "/home/myuser/.local/lib/python3.8/site-packages/flet_core/page.py", line 734, in add
    r = self.__update(self)
  File "/home/myuser/.local/lib/python3.8/site-packages/flet_core/page.py", line 832, in __update
    commands, added_controls, removed_controls = self.__prepare_update(*controls)
  File "/home/myuser/.local/lib/python3.8/site-packages/flet_core/page.py", line 848, in __prepare_update
    control.build_update_commands(
  File "/home/myuser/.local/lib/python3.8/site-packages/flet_core/control.py", line 464, in build_update_commands
    ctrl.build_update_commands(
  File "/home/myuser/.local/lib/python3.8/site-packages/flet_core/control.py", line 477, in build_update_commands
    innerCmds = ctrl._build_add_commands(
  File "/home/myuser/.local/lib/python3.8/site-packages/flet_core/control.py", line 545, in _build_add_commands
    childCmd = control._build_add_commands(
  File "/home/myuser/.local/lib/python3.8/site-packages/flet_core/control.py", line 545, in _build_add_commands
    childCmd = control._build_add_commands(
  File "/home/myuser/.local/lib/python3.8/site-packages/flet_core/control.py", line 543, in _build_add_commands
    children = self._get_children()
  File "/home/myuser/.local/lib/python3.8/site-packages/flet_core/snack_bar.py", line 130, in _get_children
    self.__content._set_attr_internal("n", "content")
AttributeError: 'NoneType' object has no attribute '_set_attr_internal'

@redromnon
Copy link
Owner

I think you're using a newer version of Flet. I've used the older Flet v0.19.0. I'll need to refactor and consider the various new Flet changes in the future.

@redromnon
Copy link
Owner

I believe you have to modify the spec file, as mentioned here: python-zeroconf/python-zeroconf#1385

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

No branches or pull requests

2 participants