Compass no longer opens

I’ve been exploring what different software is available for the Librem 5 and one I was pleased to see (especially considering the sensors are present) was the compass application at Leonardo G. Trombetta / compass · GitLab

I successfully installed using the instructions provided and used it a couple times the past few days before coming back today and finding it no longer opens.

Trying to open it with the terminal now yields this result:

purism@pureos:~$ compass
Traceback (most recent call last):
  File "/usr/local/bin/compass", line 42, in <module>
    from compass import main
  File "/usr/local/share/compass/compass/main.py", line 24, in <module>
    import xdg.BaseDirectory
ModuleNotFoundError: No module named 'xdg'
purism@pureos:~$ 

Clearly I’m missing something, but reinstalling and trying to open it again gives the same message. The phone is fully updated and all the other applications run reasonably well as far as I can see.

Does anyone have any ideas how to resolve this? I’d appreciate any suggestions on what might get it working again.

3 Likes

Did you install the Python dependencies using pip, or did you install them using the Byzantium repository?

2 Likes

I did not use pip.

Here’s what I used:

sudo apt install appstream-util gettext git libglib2.0-dev meson python3-matplotlib python3-numpy python3-pandas

1 Like

It appears to be after a Python module called “xdg”. Sorry, I don’t know what the incantation is to get that or whether it is even available at the distro version that you are at.

2 Likes

A bit of search-magic revealed:

" xdg has been renamed to xdg-base-dirs due to an import collision with PyXDG. Therefore the xdg package is deprecated. Install xdg-base-dirs instead." From: xdg · PyPI

It’s github: GitHub - srstevenson/xdg-base-dirs: An implementation of the XDG Base Directory Specification in Python where it says: " To install the latest release from PyPI, use pip: python3 -m pip install xdg-base-dirs"

4 Likes

Thank you for the additional insight and information, I installed pip using
sudo apt-get install python3-pip
which successfully installed then attempted to install the missing component using
python3 -m pip install xdg-base-dirs

Unfortunately I still received an error, this time mentioning something to the effect of not being available for the distribution.

Ultimately however, it appears the command
sudo apt-get install python3-xdg
did the trick and the compass application now opens and functions just as it did before.

Thank you to everyone who offered their knowledge and suggestions! I greatly appreciate the help as I navigate setting up my new device.

4 Likes

I’ve installed it now as well, but I’m a bit disappointed:

  • the grade numbers are missing
  • the pointer is commutes around its direction and is not fully correct (have to look for my old analog compass at home).
1 Like