# Mopidy fails with PyGObject

**URL:** <https://discourse.mopidy.com/t/mopidy-fails-with-pygobject/3612>\
**Category:** Misc\
**Created:** [November 30, 2019, 8:59pm UTC](https://discourse.mopidy.com/t/mopidy-fails-with-pygobject/3612 "2019-11-30T20:59:21Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stormtroopa](https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/32.png) [@stormtroopa](https://discourse.mopidy.com/u/stormtroopa)\
**Post date:** [November 30, 2019, 8:59pm UTC](https://discourse.mopidy.com/t/mopidy-fails-with-pygobject/3612/1 "2019-11-30T20:59:21Z")

</div>

Since today I can’t start mopidy on my mac anymore (don’t exactly know what I changed since yesterday).  
It says `"ImportError: cannot import name _gi".`  
I already googled and tried every possible solution for 3h or so.  
So I am quite desperate, and hope you are so kind and can help!

When I use brew to re-install mopidy it fails with:  
`Mopidy install fails on gst-python@2 dependency https://github.com/mopidy/homebrew-mopidy/issues/35`  
I tried to install gst-python@2 using `brew install gst-python --with-python2` but this fails with `Error: invalid option: --with-python2`  
I also tried to install pygobject which also fails.  
Working: python3 --\> import gi  
Doesn’t work: python --\> import gi --\> cannot import name \_gi

I also manually copied the gi folder from python3.7/site-packages to python2.7/site-packages. But it doesn’t help ☹

---

<div class="post-metadata">

**Author:** ![jodal](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/jodal/32/2564_2.png) [@jodal](https://discourse.mopidy.com/u/jodal)\
**Post date:** [December 23, 2019, 11:30pm UTC](https://discourse.mopidy.com/t/mopidy-fails-with-pygobject/3612/2 "2019-12-23T23:30:05Z")

</div>

Installing Mopidy 2.x on Python 2.7 with Homebrew have been broken for the last year. However, we’ve just released Mopidy 3 running on Python 3.7. The Homebrew tap is up to date, and regular `brew update; brew upgrade` should upgrade to Mopidy 3.0 for you.

---

<div class="post-metadata">

**Author:** ![stormtroopa](https://avatars.discourse-cdn.com/v4/letter/s/e47c2d/32.png) [@stormtroopa](https://discourse.mopidy.com/u/stormtroopa)\
**Post date:** [May 21, 2021, 4:45pm UTC](https://discourse.mopidy.com/t/mopidy-fails-with-pygobject/3612/3 "2021-05-21T16:45:20Z")

</div>

Thanks! Yes it works.  
Btw, yesterday a similar problem showed up: AttributeError: `module 'gi' has no attribute 'require_version'` when running mopidy.  
I could resolve it by installing the pyobject manually with brew: `brew install pygobject3`  
The issue was caused by installing mopidy-youtube via pip (not available through brew): `python3 -m pip install Mopidy-Youtube`

Maybe this helps smbd else.

---

<div class="post-metadata">

**Author:** ![system](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.mopidy.com/system/32/1_2.png) [@system](https://discourse.mopidy.com/u/system)\
**Post date:** [May 24, 2021, 4:46pm UTC](https://discourse.mopidy.com/t/mopidy-fails-with-pygobject/3612/4 "2021-05-24T16:46:13Z")

</div>

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