Error message on start of khal and ikhal


I don’t know with which update in the testing branch it started, because for a while I didn’t use khal and ikhal. But now I would like to go back to use more CLI applications and getting following error messages

Traceback (most recent call last):
  File "/usr/bin/khal", line 2, in <module>
    from khal.cli import main_khal
  File "/usr/lib/python3.10/site-packages/khal/", line 35, in <module>
    from .settings import InvalidSettingsError, get_config
  File "/usr/lib/python3.10/site-packages/khal/settings/", line 2, in <module>
    from .settings import get_config  # noqa
  File "/usr/lib/python3.10/site-packages/khal/settings/", line 26, in <module>
    import xdg.BaseDirectory
ModuleNotFoundError: No module named 'xdg.BaseDirectory'

For ikhal it’s nearly the same only the ikhal instead of khal in the second line.

I would guess the source of the problem is in another package. Maybe python-pyxdg?

It might be interesting that I get the same complaint about missing module ‘xdg.BaseDirectory’ under the build process when trying to install khal-git from the AUR instead.

My questions are:

  1. Can you verify the presence of the module at /usr/lib/python3.10/site-packages/xdg/
  2. Are you using a virtual environment (e.g. Anaconda)?
  1. Yes

  2. No, it’s directly installed on my Thinkpad.

Sorry, my second question was unclear. I meant to ask if you were using or had installed a Python virtual environment, which could prevent khal from finding what it needs.

No, I haven’t. (at least not knowingly)

Well, I’m about out of ideas, but maybe the outputs of the following commands could be useful to others.

  • echo $PATH
  • python -VV
  • python -m xdg.BaseDirectory

Ideally, there would be no output from the last command, but you might get a “No module named …”

echo $PATH
python -VV
Python 3.10.10 (main, Mar  5 2023, 22:26:53) [GCC 12.2.1 20230201]
python -m xdg.BaseDirectory
/usr/bin/python: No module named xdg.BaseDirectory

Is there something else I could provide to get help?
What I now found is, I got the same errors after uninstalling the package, installing it with pip.

Sorry to hear that you are still experiencing problems. I still have no specific ideas, but maybe we can get more information.

which python
ls -Alh /usr/lib/python3.10/site-packages/xdg
pacman -Qkk python-pyxdg
which python
l -Alh /usr/lib/python3.10/site-packages/xdg                         
totalt 176K
-rw-r--r-- 1 root root 6,2K  6 jun  2022
-rw-r--r-- 1 root root  728  6 jun  2022
-rw-r--r-- 1 root root  18K  6 jun  2022
-rw-r--r-- 1 root root 2,5K  6 jun  2022
-rw-r--r-- 1 root root  16K  6 jun  2022
-rw-r--r-- 1 root root  13K  6 jun  2022
-rw-r--r-- 1 root root  171  6 jun  2022
-rw-r--r-- 1 root root 2,2K  6 jun  2022
-rw-r--r-- 1 root root  19K  6 jun  2022
-rw-r--r-- 1 root root  39K  6 jun  2022
-rw-r--r-- 1 root root  26K  6 jun  2022
drwxr-xr-x 1 root root 1,4K 12 apr 19.18 __pycache__/
-rw-r--r-- 1 root root 6,1K  6 jun  2022
-rw-r--r-- 1 root root 2,8K  6 jun  2022
pacman -Qkk python-pyxdg
VARNING: python-pyxdg: /usr (fel GID)
python-pyxdg: Totalt 50 filer,1 ändrad fil

That’s your problem. Revert your Path.

I wonder if reinstalling python-pyxdg would not also be helpful.

pamac reinstall python-pyxdg

Thank you for your answer. But I don’t quite understand. Revert to what? Which part of my PATH is causing the issue?

Especially the first part, I would guess: /usr/lib/calibre/bin-py3

No, no difference.

I think, I give up now. It seems the project is abandoned anyway. The last news are of march 2019.
Will learn to use org-caldav in emacs instead.

Solved with testing update of 2023-05-11

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.