Skip to content

Instantly share code, notes, and snippets.

@phansch
Last active December 30, 2015 14:09
Show Gist options
  • Save phansch/7840621 to your computer and use it in GitHub Desktop.
Save phansch/7840621 to your computer and use it in GitHub Desktop.
Fixing my local jekyll setup (pygments.rb-0.5.0/lib/pygments/popen.rb:358:in `rescue in get_header': Failed to get header. (MentosError))

Jekyll failing with:

Liquid Exception: Failed to get header. in _posts/filename.md/#excerpt
/home/philipp/.rvm/gems/ruby-2.0.0-p247@global/gems/pygments.rb-0.5.0/lib/pygments/popen.rb:358:in `rescue in get_header': Failed to get header. (MentosError)
        from /home/philipp/.rvm/gems/ruby-2.0.0-p247@global/gems/pygments.rb-0.5.0/lib/pygments/popen.rb:338:in `get_header

Tracked it down to mentos.py. Running mentos.py gave me the following error:

$ python mentos.py
Traceback (most recent call last):
  File "mentos.py", line 17, in <module>
    from pygments import lexers, formatters, styles, filters
  File "/home/philipp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/pygments.rb-0.5.0/vendor/pygments-main/pygments/lexers/__init__.py", line 18, in <module>
    from pygments.plugin import find_plugin_lexers
  File "/home/philipp/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/pygments.rb-0.5.0/vendor/pygments-main/pygments/plugin.py", line 39, in <module>
    import pkg_resources
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2823, in <module>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 710, in subscribe
    callback(dist)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2823, in <lambda>
    add_activation_listener(lambda dist: dist.activate())
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2255, in activate
    self.insert_on(path)
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2362, in insert_on
    self.check_version_conflict()
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2401, in check_version_conflict
    for modname in self._get_metadata('top_level.txt'):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2249, in _get_metadata
    for line in self.get_metadata_lines(name):
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1219, in get_metadata_lines
    return yield_lines(self.get_metadata(name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1211, in get_metadata
    return self._get(self._fn(self.egg_info,name))
  File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 1326, in _get
    stream = open(path, 'rb')
IOError: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/oauthlib-0.6.0-py2.7.egg/EGG-INFO/top_level.txt'

Some time ago I installed (and removed later) bugwarrior via sudo easy_install bugwarrior And for some reason mentos.py insisted on using the oauth package in /usr/local/lib/python2.7/dist-packages/... I removed that and now jekyll is running again.

Related issues

pygments/pygments.rb#45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment