slytomcat / yandex-disk-indicator

Panel indicator (GTK+) for YandexDisk CLI client for Linux
GNU General Public License v3.0
238 stars 30 forks source link

ModuleNotFoundError: No module named 'gi' #222

Closed vasiliy0s closed 3 years ago

vasiliy0s commented 3 years ago

Hello,

I cannot start the indicator because of the next issue:

(python3.9.0) ➜  ~ yandex-disk-indicator -l10

Traceback (most recent call last):
  File "/usr/bin/yandex-disk-indicator", line 26, in <module>
    from gi import require_version
ModuleNotFoundError: No module named 'gi'

System info:

(python3.9.0) ➜  ~ python --version
Python 3.9.0
(python3.9.0) ➜  ~ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 20.04.2 LTS
Release:    20.04
Codename:   focal
(python3.9.0) ➜  ~ deactivate 
➜  ~ python --version
zsh: command not found: python
➜  ~ python3 --version
Python 3.9.0
➜  ~ which python3
/usr/local/bin/python3
➜  ~ gdm3 --version
GDM 3.36.3
➜  ~ sudo apt install  gnome-shell-extension-appindicator 
Reading package lists... Done
Building dependency tree       
Reading state information... Done
gnome-shell-extension-appindicator is already the newest version (33.1-0ubuntu0.20.04.2).
gnome-shell-extension-appindicator set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

* Python was built from the sources because I need this specific version.

My OS is x64, btw)

slytomcat commented 3 years ago

Try to install python3-gi package manually: sudo apt-get install python3-gi

vasiliy0s commented 3 years ago

sudo apt-get install python3-gi

I was tried it as the first step after some googling:

➜  ~ sudo apt-get install python3-gi
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-gi is already the newest version (3.36.0-1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
vasiliy0s commented 3 years ago

But I'm not sure it can help me, because my Python 3.9.0 was build from sources.

slytomcat commented 3 years ago

Probably you have to build python3-gi from sources for python 3.9.0 or just copy (dirty hack) it from 3.36.0 (from /usr/lib/python3/dist-packages/gi) to your 3.9.0 python library path.

vasiliy0s commented 3 years ago

Ok, got it. I'll back when I'll try it tomorrow. Thanks

slytomcat commented 3 years ago

... one more variant: just run indicator in Python 3.36.0 (if it still available in your OS).

vasiliy0s commented 3 years ago

Hi @slytomcat,

Here is the trick helped me:

pip install pygobject

(pip in my setup is from virtualenv from the Python3.9.0 build)

vasiliy0s commented 3 years ago

Also, I rebuilt Python previously with enabled sqlite ./configure --enable-loadable-sqlite-extensions --enable-optimizations.

vasiliy0s commented 3 years ago

So, this issue can be closed now since the indicator is working fine now

slytomcat commented 3 years ago

Ok, it seems that pip install pygobject is the solution for necessary python environment for indicator when Python was build from sources.

Probably it worth to add it to FAQ.