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

[BUG] ModuleNotFoundError: No module named 'icalendar.prop' #781

Open
CloCkWeRX opened this issue Feb 15, 2025 · 2 comments
Open

[BUG] ModuleNotFoundError: No module named 'icalendar.prop' #781

CloCkWeRX opened this issue Feb 15, 2025 · 2 comments

Comments

@CloCkWeRX
Copy link

CloCkWeRX commented Feb 15, 2025

Describe the bug

From: home-assistant/core#138333

Setup failed for 'caldav': Unable to import component: No module named 'icalendar.prop'
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/setup.py", line 340, in _async_setup_component
    component = await integration.async_get_component()
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1035, in async_get_component
    self._component_future.result()
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1015, in async_get_component
    comp = await self.hass.async_add_import_executor_job(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        self._get_component, True
        ^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File "/usr/local/lib/python3.13/concurrent/futures/thread.py", line 59, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/src/homeassistant/homeassistant/loader.py", line 1075, in _get_component
    ComponentProtocol, importlib.import_module(self.pkg_path)
                       ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^
  File "/usr/src/homeassistant/homeassistant/util/loop.py", line 201, in protected_loop_func
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.13/importlib/__init__.py", line 88, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/usr/src/homeassistant/homeassistant/components/caldav/__init__.py", line 5, in <module>
    import caldav
  File "/usr/local/lib/python3.13/site-packages/caldav/__init__.py", line 8, in <module>
    from .davclient import DAVClient
  File "/usr/local/lib/python3.13/site-packages/caldav/davclient.py", line 15, in <module>
    from caldav.objects import Calendar
  File "/usr/local/lib/python3.13/site-packages/caldav/objects.py", line 19, in <module>
    import icalendar
  File "/usr/local/lib/python3.13/site-packages/icalendar/__init__.py", line 1, in <module>
    from icalendar.alarms import (
    ...<6 lines>...
    )
  File "/usr/local/lib/python3.13/site-packages/icalendar/alarms.py", line 19, in <module>
    from icalendar.cal import Alarm, Event, Todo
  File "/usr/local/lib/python3.13/site-packages/icalendar/cal.py", line 19, in <module>
    from icalendar.parser import Contentline, Contentlines, Parameters, q_join, q_split
  File "/usr/local/lib/python3.13/site-packages/icalendar/parser.py", line 386, in <module>
    from icalendar.prop import vText
ModuleNotFoundError: No module named 'icalendar.prop'

Unclear if this is specifically 6.1.1 or a slightly earlier version.

https://github.com/collective/icalendar/blob/main/src/icalendar/parser.py#L386 has comments pointing out the include at the bottom is unusual, has anything changed in the way this library is packaged or similar?

@niccokunzmann
Copy link
Member

I don't think we changed something like that. #779 Seems to be a similar issue: a module file is missing. Can you print icalendar.__version__ ?
What does this print for you?

find /usr/local/lib/python3.13/site-packages/icalendar*

@niccokunzmann
Copy link
Member

niccokunzmann commented Feb 17, 2025

from icalendar.prop import vText

could be solved by moving the import before this line:

values = vText(values).to_ical()


I would expect a different ImportError - or maybe Python3.13 changed behavior? Something like "cannot import .... from not fully initialized module"
One thing I notice, would be that the 'icalendar.prop' is imported and that could lead to a different import order than import icalendar.

So, can you confirm if the change above solves the issue? Could you create a PR if it does?

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