keithfancher / todo-indicator

Ubuntu app indicator for todo.txt-style todo lists
GNU General Public License v3.0
48 stars 8 forks source link

Problem after Switching to Xubuntu 24.04.1 #9

Closed vexillia closed 1 week ago

vexillia commented 2 weeks ago

After a clean install, I had to re-install the indicator. As it's 24.04 I had to use pipx. Everything installs OK. When I run the program I get this error:

File "~/.local/share/pipx/venvs/todo-indicator/lib/python3.12/site-packages/todo_indicator/indicator.py", line 19, in import gi ModuleNotFoundError: No module named 'gi'

I assume it's to do with the virtual environment but I don't know enough to be sure.

Help please.

keithfancher commented 2 weeks ago

Hm... did you install the dependencies as described in the README? Try this out:

sudo apt install python3-pyinotify python3-gi gir1.2-appindicator3-0.1

If this doesn't do the trick, it's possible the packages are a little different in 24.04... I'm still on 22.04 myself so I can't be sure. (If the above doesn't work, I can fire up a VM and do some testing myself, though.)

vexillia commented 2 weeks ago

The dependencies are all there (as instructed). This might help:

https://www.omgubuntu.co.uk/2023/04/pip-install-error-externally-managed-environment-fix

keithfancher commented 2 weeks ago

Ahhh, I see what's going on now. Annoying to have breakage like this, but pipx seems like a step in the right direction to me.

TL;DR: For now, just uninstall and then re-install with the --system-site-packages option, e.g. pipx install --system-site-packages todo-indicator.

More detail, and other options, below :smile:

And thank you for bringing this to my attention! I'll update the documentation with this info once I've had more of a chance to test. (And/or consider moving the PyGObject dependency into the "real" dependencies of the project, finally. But I believe that still requires users to have a development env set up on their machine to build it, hmmm...)


There are actually some (very minor) hoops to jump through to get todo-indicator to run in a virtual env (which is what pipx is doing). This is just a slight variation of how you'd get setup for contributing to todo-indicator, as a matter of fact.

I haven't installed 24.04 yet to test, but there are a couple of approaches that should work here. The first option should be quick-and-easy:

1. Uninstall todo-indicator and re-install with the --system-site-packages option:

pipx install --system-site-packages todo-indicator

The above exposes packages you've installed via apt to your virtual env. (This worked for me using pipx in 22.04, by the way.)

If that doesn't work, or if you want to isolate your environment more, OR if you're just curious you can try:

2. "Inject" the dependencies into your pipx virtual env. You'll need to download the latest todo-indicator requirements.txt file, which just lives in the project root. In this case you can install normally with pipx, then use the inject command to install the dependencies. Something like this (assuming requirements.txt is now in your working directory):

pipx install todo-indicator
pipx inject todo-indicator -r requirements.txt

Note that, IIRC, the pypi package for PyGObject requires you to have development dependencies installed because it actually builds the library on your machine. This is why it's so much easier to simply install the dependencies with apt and expose them to your env, if you're just an end-user of todo-indicator.

vexillia commented 2 weeks ago

Option 1. works.

Thanks.

keithfancher commented 1 week ago

Updated the README to account for pipx! Thanks again for filing. Closing this out now.