# ModuleNotFoundError: No module named 'gi'

**URL:** <https://discourse.mopidy.com/t/modulenotfounderror-no-module-named-gi/4197>\
**Category:** Misc\
**Created:** [July 25, 2020, 9:35pm UTC](https://discourse.mopidy.com/t/modulenotfounderror-no-module-named-gi/4197 "2020-07-25T21:35:39Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![artelse](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@artelse](https://discourse.mopidy.com/u/artelse)\
**Post date:** [July 25, 2020, 9:35pm UTC](https://discourse.mopidy.com/t/modulenotfounderror-no-module-named-gi/4197/1 "2020-07-25T21:35:39Z")

</div>

I installed Mopidy by means of PyPi on Debian stretch according to the instructions, so installed dependencies before. It runs on a compiled python3.7 with no other python version installed.  
When I start mopidy I get this error:  
`ModuleNotFoundError: No module named 'gi'`  
Anyone has an idea?  
Edit: apparently `gi` got installed in `/usr/lib/python3/dist-packages`. Putting this on PYTHONPATH made it find `gi`, but then got this error:  
`ImportError: cannot import name '_gi' from 'gi' (/usr/lib/python3/dist-packages/gi/ __init__.py)`

---

<div class="post-metadata">

**Author:** ![sapristi](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/sapristi/32/1364_2.png) [@sapristi](https://discourse.mopidy.com/u/sapristi)\
**Post date:** [July 26, 2020, 6:46am UTC](https://discourse.mopidy.com/t/modulenotfounderror-no-module-named-gi/4197/2 "2020-07-26T06:46:41Z")

</div>

Hi,  
did you install mopidy in a virtual env (or conda env) ? If yes, I think that’s where the issue come from. There are issues with virtual envs and python-gi.  
You could install mopidy with no virtualenv and that should work; I just found [https://stackoverflow.com/questions/26678457/how-do-i-install-python3-gi-within-virtualenv](https://stackoverflow.com/questions/26678457/how-do-i-install-python3-gi-within-virtualenv) , maybe that could solve the problem as well, there is a section in the doc as well: [https://docs.mopidy.com/en/latest/devenv/#make-a-virtualenv](https://docs.mopidy.com/en/latest/devenv/#make-a-virtualenv)

---

<div class="post-metadata">

**Author:** ![kingosticks](https://avatars.discourse-cdn.com/v4/letter/k/858c86/32.png) [@kingosticks](https://discourse.mopidy.com/u/kingosticks)\
**Post date:** [July 26, 2020, 8:15am UTC](https://discourse.mopidy.com/t/modulenotfounderror-no-module-named-gi/4197/3 "2020-07-26T08:15:12Z")

</div>

> **[Mopidy 3 Upgrade FAQ](https://mopidy.com/blog/2019/12/27/mopidy-3-faq/#what-about-mopidy-3-on-debian-stretch)**
>
> Mopidy 3.0 is a backwards-incompatible release. This post aims to address common questions that users and/or developers may have when they come to upgrade.

---

<div class="post-metadata">

**Author:** ![artelse](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@artelse](https://discourse.mopidy.com/u/artelse)\
**Post date:** [July 26, 2020, 10:45am UTC](https://discourse.mopidy.com/t/modulenotfounderror-no-module-named-gi/4197/4 "2020-07-26T10:45:08Z")

</div>

Thanks for the info. I’ll try to get Debian Buster up and running, because it has both python3.7 and gstreamer1.14 in the repo. Would be a better solution as I won’t need to recompile python3.7 again; took 4+ hours on an armhf architecture…

---

<div class="post-metadata">

**Author:** ![artelse](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@artelse](https://discourse.mopidy.com/u/artelse)\
**Post date:** [July 26, 2020, 6:17pm UTC](https://discourse.mopidy.com/t/modulenotfounderror-no-module-named-gi/4197/5 "2020-07-26T18:17:08Z")

</div>

In the mean time have been able to get Debian Buster running. Installed mopidy through `apt-get`. Now if I want to install `mopidy-mpd`, it reports mopidy needs version 3 and it appears version 2.2.2 was installed.  
I have looked around, checked the FAQ above, but how can I get version 3 on my system? Surprised it’s not on the repo.

Edit: deleted the apt-get repo version of mopidy, removed all and then installed the pypi version. It installs all the right dependencies and just seems to run fine 🙂 So the debian repo might need fixing, but the main stumble block seems a too old `python3-pykka` on the repo.
