Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Liquid Exception (No such file or directory) when using Pygments #2551

Closed
winghouchan opened this issue Jun 28, 2014 · 35 comments
Closed

Liquid Exception (No such file or directory) when using Pygments #2551

winghouchan opened this issue Jun 28, 2014 · 35 comments

Comments

@winghouchan
Copy link

Howdy all!

Upon running jekyll build or jekyll build --watch I am getting the following error:

Liquid Exception: No such file or directory - python C:/Ruby193/lib/ruby/gems/1.9.1/gems/pygments.rb-0.5.0/lib/pygments/mentos.py in _posts/2014/06/28-Name-of-post.md

You might be wondering why I'm using Pygments 0.5.0. That's because when using the version shipped with Jekyll (0.5.4) I experience the problem in issue #2052 . The workaround described by @michaelplus was to revert to Pygments 0.5.0, however it is obvious it did not work for me.

Looking at the error, it states "No such file or directory", however when I follow the path in the error (C:/Ruby193/lib...) I find that the path is valid.

Searching on StackOverflow, several suggestions have been made, including reverting to Pygments 0.5.0 and using Python < 3.0.0. I have already reverted to Pygments 0.5.0 and my Python version is 2.7.7 .

Anyone have any ideas?

@kleinfreund
Copy link

Wasn't upgrading to Ruby v2.0.0 part of that workaround? I had to do this myself as well. Currently running Ruby v2.0.0p451, Python v2.7.6, Pygments v0.5.0.

@winghouchan
Copy link
Author

Hey @kleinfreund!

Thanks for the quick reply. I just reread the StackOverflow question, which is here: http://stackoverflow.com/questions/17364028/jekyll-on-windows-pygments-not-working and upgrading Ruby wasn't part of the workaround, although I'll give it a try.

Thank you!

@winghouchan
Copy link
Author

Back from installing Ruby 2.0.0 (p484) as per @kleinfreund's suggestion.

Upon running jekyll build it seemed to add more problems:

Liquid Exception: cannot load such file -- yajl/2.0/yajl in _posts/2014/06/28-Name-of-post.md
C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- yajl/2.0/yajl (LoadError)
        from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/yajl-ruby-1.1.0-x86-mingw32/lib/yajl/yajl.rb:2:in `<top(required)>'
        from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/yajl-ruby-1.1.0-x86-mingw32/lib/yajl.rb:1:in `<top(required)>'
        from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `require'
        from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
        from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:144:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/pygments.rb-0.5.4/lib/pygments/popen.rb:3:in `<top(required)>'
        from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/pygments.rb-0.5.4/lib/pygments.rb:1:in `<top(required)>'
        from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Ruby200/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/tags/highlight.rb:53:in`render_pygments'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/tags/highlight.rb:41:in `render'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.5/lib/liquid/block.rb:106:in `block in render_all'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.5/lib/liquid/block.rb:93:in `each'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.5/lib/liquid/block.rb:93:in `render_all'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.5/lib/liquid/block.rb:82:in `render'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.5/lib/liquid/template.rb:124:in `render'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/liquid-2.5.5/lib/liquid/template.rb:132:in `render!'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/convertible.rb:96:in `render_liquid'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/convertible.rb:170:in `do_layout'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/post.rb:266:in `render'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/site.rb:245:in `block in render'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/site.rb:244:in `each'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/site.rb:244:in `render'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/site.rb:43:in `process'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/command.rb:43:in `process_site'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/commands/build.rb:46:in `build'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/commands/build.rb:30:in `process'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/lib/jekyll/commands/build.rb:17:in`block(2levels) in init_with_program'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in `call'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in`block in execute'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in`each'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mercenary-0.3.3/lib/mercenary/command.rb:220:in`execute'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mercenary-0.3.3/lib/mercenary/program.rb:35:in `go'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/mercenary-0.3.3/lib/mercenary.rb:22:in `program'
        from C:/Ruby200/lib/ruby/gems/2.0.0/gems/jekyll-2.0.3/bin/jekyll:18:in `<top (required)>'
        from C:/Ruby200/bin/jekyll:23:in `load'
        from C:/Ruby200/bin/jekyll:23:in `<main>'

@winghouchan
Copy link
Author

Regarding the above error, it seems to be a problem about version compatability. See here: brianmario/yajl-ruby#116

@kleinfreund
Copy link

FYI, my yajl-ruby version is v1.1.0. Can you give us the gem list, please?

@winghouchan
Copy link
Author

Here we go:

  • bigdecimal (1.2.0)
  • blankslate (2.1.2.4)
  • celluloid (0.15.2)
  • classifier (1.3.4)
  • coffee-script (2.2.0)
  • coffee-script-source (1.7.0)
  • colorator (0.1)
  • execjs (2.2.1)
  • fast-stemmer (1.0.2)
  • ffi (1.9.3 x86-mingw32)
  • io-console (0.4.2)
  • jekyll (2.0.3)
  • jekyll-coffeescript (1.0.0)
  • jekyll-sass-converter (1.0.0)
  • json (1.7.7)
  • kramdown (1.4.0)
  • liquid (2.5.5)
  • listen (2.7.9)
  • mercenary (0.3.3)
  • minitest (4.3.2)
  • parslet (1.5.0)
  • posix-spawn (0.3.8)
  • psych (2.0.0)
  • pygments.rb (0.5.4)
  • rake (0.9.6)
  • rb-fsevent (0.9.4)
  • rb-inotify (0.9.5)
  • rdoc (4.0.0)
  • redcarpet (3.1.2)
  • safe_yaml (1.0.3)
  • sass (3.3.9)
  • test-unit (2.0.0.0)
  • timers (1.1.0)
  • toml (0.1.1)
  • yajl-ruby (1.1.0 x86-mingw32)

@kleinfreund
Copy link

Install pygments v0.5.0, maybe?^^ Also, are you a Windows user? If so, isn't wdm necessary as well?

@kleinfreund
Copy link

So you still get that yajl error with yajl-ruby v1.1.0 and pygments v0.5.0?

I updated my gems to the versions of your gem list to maybe reproduce, but everything works.

@winghouchan
Copy link
Author

Yep, still the same error and still not working 😦

New gem list:

  • bigdecimal (1.2.0)
  • blankslate (2.1.2.4)
  • celluloid (0.15.2)
  • classifier (1.3.4)
  • coffee-script (2.2.0)
  • coffee-script-source (1.7.0)
  • colorator (0.1)
  • execjs (2.2.1)
  • fast-stemmer (1.0.2)
  • ffi (1.9.3 x86-mingw32)
  • io-console (0.4.2)
  • jekyll (2.0.3)
  • jekyll-coffeescript (1.0.0)
  • jekyll-sass-converter (1.0.0)
  • json (1.7.7)
  • kramdown (1.4.0)
  • liquid (2.5.5)
  • listen (2.7.9)
  • mercenary (0.3.3)
  • minitest (4.3.2)
  • parslet (1.5.0)
  • posix-spawn (0.3.8)
  • psych (2.0.0)
  • pygments.rb (0.5.0)
  • rake (0.9.6)
  • rb-fsevent (0.9.4)
  • rb-inotify (0.9.5)
  • rdoc (4.0.0)
  • redcarpet (3.1.2)
  • safe_yaml (1.0.3)
  • sass (3.3.9)
  • test-unit (2.0.0.0)
  • timers (1.1.0)
  • toml (0.1.1)
  • wdm (0.1.0)
  • yajl-ruby (1.1.0 x86-mingw32)

@kleinfreund
Copy link

Can you post the contents of that .md file? I have no idea. We're almost running the exact same setup. Strange. :/

@winghouchan
Copy link
Author

Indeed it is strange. I've followed a few solutions but none of them work and also as you said our setup is almost exactly the same.

Here is my post (it's not quite finished yet btw):

code removed

@kleinfreund
Copy link

I can build and serve --watch without errors (same filename).

@parkr
Copy link
Member

parkr commented Jun 28, 2014

Have you tried the Rouge syntax highlighter?

There's a patch you need to apply to pygments to get it to work on Windows IIRC. I think you have to set the python version to like python27 or something. Hrm.

@winghouchan
Copy link
Author

Hey @parkr!

I've tried Rouge but for some reason the error still appears.

About setting the Python version. The closest thing I can think of is downgrading any version of Python above 3 below 3. I have Python 2.7.7 so that shouldn't be a problem.

But if you can recall anything that'd be great!

@parkr
Copy link
Member

parkr commented Jun 28, 2014

@winghouchan Is python2 available on your machine? Maybe you can hardcode the path to your installation in https://github.com/tmm1/pygments.rb/blob/f06e1b50194adbea2ae9b0bf5001b517e2ed426f/lib/pygments/popen.rb#L47

@kleinfreund
Copy link

That is a good hint by parkr. Check if this is part of your path environment variable: ;C:\python27.

Go to the Startmenu, Rightclick Computer, hit Properties. Click Advanced Systemsettings (or something similar), Extended and Environment Variables.

Open Start menu and enter Environment variables.

If the value of path doesn't have ;C:\python27, add it directly behind.

@winghouchan
Copy link
Author

Hey @parkr and @kleinfreund!

Thank you both for your help! Without it I'd probably be pulling my hair out for another hour!

Adding C:\Python27 to the Path variable under System Variables solved the problem!

@parkr
Copy link
Member

parkr commented Jun 28, 2014

BOOM! @kleinfreund, you da 💣. Well done, sir.

@winghouchan
Copy link
Author

👍

@vladsandulescu
Copy link

The path helped me also, thanks a lot!

@yuxiaomin
Copy link

Add python folder to path solved my problem, thanks.

@M1chae1
Copy link

M1chae1 commented Aug 4, 2014

This works. Thanks. This post save my time. 👍

@ianpaul
Copy link

ianpaul commented Sep 11, 2014

Beautiful! This worked for me too. I had added Python to the path under user variables, but not the system ones. Glad I came across this thread!

@danilobjr
Copy link

Wow, guys! Thank you so much! Solved here!

@XhmikosR
Copy link
Contributor

Note, that this issue still happens with Ruby >= 2.0 regardless if Python is in PATH. The issue arises from pygments.rb trying to load yajl-ruby 1.1.0-x86-mingw32 instead of 1.2.1 which I have installed.

One can easily reproduce this by checking out Jekyll's own repository, doing bundle install and then bundle exec rake site:preview.

Workaround: Change yajl-ruby to 1.2.1 in Gemfile.lock.

@nickedes
Copy link

Thanx 💣 😌

@philippneugebauer
Copy link

great tip! thanks @XhmikosR

@chc24
Copy link

chc24 commented Mar 10, 2015

@XhmikosR , can you explain in more detail how to change it exactly? I've been having this same problem. thanks.

@XhmikosR
Copy link
Contributor

@chc24: this issue is fixed with pygments.rb 0.6.1, so just update your gems.

@frankmolenaar1986
Copy link

THIS IS THE BEST THANK YOU SO MUCH I AM SORRY FOR CAPSLOCK BUT AFTER 3 HOURS OF FIDGETTING AROUND THIS FIXED IT! THANK YOU @kleinfreund

@mslfire
Copy link

mslfire commented Apr 27, 2015

I have the same - issue/error - my pygments.rb-0.6.3
HOW do you change the line?? DO YOU JUST CHANGE THE gem folder name which in my case is named 'yajl-ruby-1.2.1' to 1.2.1???

@kleinfreund
Copy link

@mslfire Can you see if your PATH environment variable has the following?

Open Start menu and enter Environment variables.

If the value of path doesn't have ;C:\python27, add it directly behind.

@mslfire
Copy link

mslfire commented Apr 27, 2015

That does it thanks - had to close and reopen command line!!

@quannt
Copy link

quannt commented Jun 6, 2015

Thanks. Adding the Pythod path did it for me. To be fair, the Jekyll guide could have been more clear about having Python installed.

@envygeeks
Copy link
Contributor

Hello. This ticket is being locked because it is stale and further comment here is no longer beneficial. Please create a new ticket with your bug or feature request and link back to this ticket. This will help us better manage your issue. If this is a question then please ask your question at https://talk.jekyllrb.com rather than on this ticket system.

Thanks!

@jekyll jekyll locked and limited conversation to collaborators Jun 7, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests