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

Module only partially copied - No module named 'zeroconf._utils.ipaddress' #840

Open
C0rn3j opened this issue Dec 19, 2024 · 2 comments
Open
Labels
good first issue Good for newcomers

Comments

@C0rn3j
Copy link

C0rn3j commented Dec 19, 2024

  • pyinstaller: 6.11.1
  • Python: 3.12.7 / 3.13.x on the build system
  • Platform: Arch Linux
  • How you installed Python: System
  • Did you also try this on another platform? Does it work there: macOS fails the same way
  • Try the latest development version: Still happens

The app uses pychromecast, which has a dependency on zeroconf.

I have tried adding both as a hiddenimport, but it still fails.

Traceback (most recent call last):
  File "tauon/t_modules/t_main.py", line 8549, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 384, in exec_module
  File "tauon/t_modules/t_chrome.py", line 7, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 384, in exec_module
  File "pychromecast/__init__.py", line 15, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 384, in exec_module
  File "zeroconf/__init__.py", line 24, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 384, in exec_module
  File "zeroconf/_core.py", line 32, in <module>
  File "PyInstaller/loader/pyimod02_importers.py", line 384, 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'

It turns out the module is there, but only partially:

image

One can repro this by

The pychromecast module is loaded like such:

try:
	from tauon.t_modules.t_chrome import Chrome
except ModuleNotFoundError:
	logging.exception("Test exception DELETE THIS LINE.")
	logging.warning("Unable to import Chrome(pychromecast), chromecast support will be disabled.")
except Exception:
	logging.exception("Unknown error trying to import Chrome(pychromecast), chromecast support will be disabled.")
finally:
	chrome = Chrome(tauon)
	logging.debug("Found import Chrome(pychromecast) for chromecast support")

Which imports from this file - https://github.com/C0rn3j/Tauon/blob/macos-dmg/src/tauon/t_modules/t_chrome.py

@rokm
Copy link
Member

rokm commented Dec 19, 2024

Looks like zeroconf is aggressively cythonized (at least PyPI wheels), and those cythonized extensions cannot be analyzed for imports (I see that they have accompanying .py files that could be used for import analysis, but we have no support for that in modulegraph).

So either you'll need to add all missing modules from that package to hiddenimports; either using e.g. --hiddenimport zeroconf._utils.ipaddress if there are a few of them, or --collect-submodules zeroconf if there are many. If you are building using a spec, then you'll need to populate hiddenimports list (either manually for few entries, or using PyInstaller.utils.hooks.collect_submodules('zeroconf')).

@C0rn3j
Copy link
Author

C0rn3j commented Dec 19, 2024

Adding these two seems to have done the trick for now - thank you!

"zeroconf._utils.ipaddress",
"zeroconf._handlers.answers",

@bwoodsend bwoodsend transferred this issue from pyinstaller/pyinstaller Dec 19, 2024
@bwoodsend bwoodsend added good first issue Good for newcomers and removed triage labels Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

3 participants