Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Install issue on OSx #330

gilbertbw opened this Issue · 9 comments

4 participants


When running sudo pip install -U pyspotify pylast pykka mopidy

I recive this error:

clang: warning: argument unused during compilation: '-mno-fused-madd'
src/module.c:3:10: fatal error: 'libspotify/api.h' file not found
#include "libspotify/api.h"
1 error generated.
error: command 'clang' failed with exit status 1

But libspotify is definitely installed? I.e.
brew install gst-python gst-plugins-good gst-plugins-ugly libspotify


I re-ran brew install libspotify but the pid command now works but running `mopidy' causes this error:

Traceback (most recent call last):
  File "/usr/local/bin/mopidy", line 4, in <module>
    from mopidy.__main__ import main
  File "/Library/Python/2.7/site-packages/mopidy/", line 30, in <module>
    from mopidy.utils.settings import SettingsProxy
  File "/Library/Python/2.7/site-packages/mopidy/utils/", line 13, in <module>
    from mopidy.utils import formatting, path
  File "/Library/Python/2.7/site-packages/mopidy/utils/", line 12, in <module>
    import glib
ImportError: No module named glib

So you've got more missing dependency, looks like python-object which I'd have thought brew would've taken care of when installing the various gst-* packages. I don't have a mac myself but I'm very surprised this doesn't just work.

EDIT: Is gst-python definitely installed? I suggest you re-run the brew install command in it's entirety.


The glib Python package is provided by the Homebrew formula pygobject.

If you follow the OS X instructions at, you should have installed gst-python from Homebrew, which depends on pygtk, which again depends on pygobject, and thus it should work.


@gilbertbw Did you get it working? :-)


No, running brew install gst-python gives Error: gst-python-0.10.22 already installed and the error the glib is not installed is still there


OS X comes bundled with a Python installation. In addition, Homebrew can install (newer) Python versions as well. which python will show you which Python installation you're using. /usr/bin/python indicates OS X Python, while /usr/bin/local/python indicates Homebrew Python. Both are good to go, you just need to be aware of which one you're using. Irrespective of which Python installation you're using, Homebrew will install the Python modules into /usr/local. I'll show you the effect of this...

python -c 'import pprint, sys; pprint.pprint(sys.path)' will show the list of dirs searched for installed Python modules (known as the PYTHONPATH) when you try to import a module.

E.g., on a OS X system I have access to, it looks like this:

$ which python
/usr/bin/python             # OS X Python
$ python --version
Python 2.7.2
$ python -c 'import pprint, sys; pprint.pprint(sys.path)'
$ python -c 'import glib'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named glib

The pygobject and the glib module is installed:

$ brew list pygobject
/usr/local/Cellar/pygobject/2.28.6/include/pygtk-2.0/ (2 files)
/usr/local/Cellar/pygobject/2.28.6/lib/python2.7/ (29 files)
/usr/local/Cellar/pygobject/2.28.6/share/gtk-doc/ (57 files)
/usr/local/Cellar/pygobject/2.28.6/share/pygobject/ (71 files)

The reason I can't import the installed glib using my OS X bundled Python is that it's installed in /usr/local/lib/python2.7/site-packages, which isn't included in the list of search paths.

You was probably informed of this caveat when you installed the package, but it drowned in the amount of output from Homebrew. You can check out the instructions using brew info package-name:

$ brew info gst-python
gst-python: stable 0.10.22
Depends on: pkg-config, gst-plugins-base, pygtk
/usr/local/Cellar/gst-python/0.10.21 (66 files, 1.6M)
/usr/local/Cellar/gst-python/0.10.22 (70 files, 1.6M) *
==> Caveats
For non-Homebrew Python, you need to amend your PYTHONPATH like so:
  export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH

If we update the PYTHONPATH to include Homebrew's site-packages dir as instructed by the caveats section above, importing glib using the OS X bundled Python installation works:

$ export PYTHONPATH=/usr/local/lib/python2.7/site-packages:$PYTHONPATH
$ python -c 'import glib; print dir(glib)[:3]'
['GError', 'IOChannel', 'IO_ERR']

To make the PYTHONPATH permanently include Homebrew's site-packages, add the export line to your shell's init file, typically ~/.bashrc.

Please let me know how this works out for you!


Closing because of no feedback from user for a month.

@jodal jodal closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.