Giter VIP home page Giter VIP logo

Comments (48)

tmm1 avatar tmm1 commented on June 25, 2024

Try :exe => 'python2.6'

On Sat, Oct 22, 2011 at 2:25 PM, Yorick <
[email protected]>wrote:

When running the Pyagments::Lexer class (as shown below) it complains about
the lib.so file not being found. As the issue seemed similar to #7 I've
tried following the steps there but this did not resolve the issue, the
output below also contains an attempt at using the RubyPython configuration
but neither the options 'python' nor 'python2' seem to help (which makes
sense as python is available under the 'python' alias rather than python2).

 => {:python_exe=>"python"}
ruby-1.9.2-p290 :002 > Pygments::Lexer[:bash]
LoadError: Could not open library 'lib.so': lib.so: cannot open shared
object file: No such file or directory
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/ffi-1.0.10/lib/ffi/library.rb:121:in
`block in ffi_lib'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/ffi-1.0.10/lib/ffi/library.rb:88:in
`map'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/ffi-1.0.10/lib/ffi/library.rb:88:in
`ffi_lib'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/rubypython-0.5.2/lib/rubypython/python.rb:29:in
`<module:Python>'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/rubypython-0.5.2/lib/rubypython/python.rb:21:in
`<top (required)>'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in
`load'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in
`block in load'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in
`block in load_dependency'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in
`new_constants_in'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in
`load_dependency'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:234:in
`load'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/rubypython-0.5.2/lib/rubypython.rb:261:in
`reload_library'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/rubypython-0.5.2/lib/rubypython.rb:104:in
`start'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/pygments.rb-0.2.3/lib/pygments/ffi.rb:8:in
`start'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/pygments.rb-0.2.3/lib/pygments/ffi.rb:42:in
`lexers'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/pygments.rb-0.2.3/lib/pygments/lexer.rb:147:in
`<module:Pygments>'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/pygments.rb-0.2.3/lib/pygments/lexer.rb:1:in
`<top (required)>'
       from (irb):2
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/railties-3.1.0/lib/rails/commands/console.rb:45:in
`start'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/railties-3.1.0/lib/rails/commands/console.rb:8:in
`start'
       from /home/ruby/.rvm/gems/ruby-1.9.2-p290@gitlab/gems/railties-3.1.0/lib/rails/commands.rb:40:in
`<top (required)>'
       from script/rails:6:in`require'
       from script/rails:6:in `<main>'

This is on a machine with Debian 6 x64 with ia32 libs installed, Python
2.6.6 and Ruby 1.9.2. I suppose this should just be able to run or am I
overlooking another requirement? Thanks in advance either way.

--
Reply to this email directly or view it on GitHub:
#10

from pygments.rb.

tmm1 avatar tmm1 commented on June 25, 2024

This must be an issue with the .so lookup code /cc @halostatue

Can you make sure you have a python-dev package installed?

from pygments.rb.

yholkamp avatar yholkamp commented on June 25, 2024

After running a apt-get install python-dev it works flawlessly - I didn't realize this was a requirement for the gem, thanks a lot!

from pygments.rb.

tmm1 avatar tmm1 commented on June 25, 2024

Can you check what ls -alh /usr/lib/libpython2.*.so returns?

The python-dev package adds a .so symlink to an existing libpython.so.1 usually, which rubypython also looks for. What is the full filename for libpython on your machine?

from pygments.rb.

halostatue avatar halostatue commented on June 25, 2024

wouldn't it be ls -alh /usr/lib/libpython2_so_ (no dots) to get the best information?

from pygments.rb.

yholkamp avatar yholkamp commented on June 25, 2024

Running that command even more generic gives the following output;

$ ls -alh /usr/lib/libpython*so*
lrwxrwxrwx 1 root root   17 Oct 23 01:02 /usr/lib/libpython2.6.so -> libpython2.6.so.1
lrwxrwxrwx 1 root root   19 Oct 23 01:02 /usr/lib/libpython2.6.so.1 -> libpython2.6.so.1.0
-rw-r--r-- 1 root root 2.7M Dec 27  2010 /usr/lib/libpython2.6.so.1.0

from pygments.rb.

halostatue avatar halostatue commented on June 25, 2024

Interesting. I'm guessing that if you removed python-dev (actually python2.6-dev), both symlinks (libpython2.6.so and libpython2.6.so.1) would be removed. I can add another special case for .so.1.0 so that python-dev isn't necessary, but that seems a little ugly.

from pygments.rb.

halostatue avatar halostatue commented on June 25, 2024

OK, so that guess was wrong. However, we should be looking for libpython2.6.so.1 anyway, per pythonexec.rb line 61. I'm confused, now.

from pygments.rb.

tmm1 avatar tmm1 commented on June 25, 2024

Can you try something like: for i in /usr/lib/libpython*so*; do dpkg -S $i; done

from pygments.rb.

sairam avatar sairam commented on June 25, 2024

If you are looking for the solution for a Fedora x64 distro, Here is the solution:

install python-devel via yum . it would point the libpython*so* at /usr/lib64/ . But the ffi only looks at /usr/lib/ .

yum install python-devel
cd /usr/lib
ln -sf /usr/lib64/libpython2.6.so
ln -sf /usr/lib64/libpython2.6.so.1.0

from pygments.rb.

halostatue avatar halostatue commented on June 25, 2024

@sairam: that's no longer necessary as of rubypython 0.5.3.

The problem is that for some reason, libpython2.6.so.1 isn't being seen and it should be.

from pygments.rb.

sairam avatar sairam commented on June 25, 2024

looks like rubypython 0.5.3 was released just yesterday. tried upgrading to 0.5.3 . my gemfile locked it to 0.5.1 and hence the problem . Thanks @halostatue

from pygments.rb.

yholkamp avatar yholkamp commented on June 25, 2024

@tmm1:```
python2.6-dev: /usr/lib/libpython2.6.so
libpython2.6: /usr/lib/libpython2.6.so.1
libpython2.6: /usr/lib/libpython2.6.so.1.0

from pygments.rb.

lmarburger avatar lmarburger commented on June 25, 2024

I'm having the same issue running on Heroku's cedar stack since upgrading to the latest version fo pygments.rb and rubypython. Here's the output from the command @tmm1 pasted:

irb(main):015:0> puts `for i in /usr/lib/libpython*so*; do dpkg -S $i; done`
puts `for i in /usr/lib/libpython*so*; do dpkg -S $i; done`
libpython2.6: /usr/lib/libpython2.6.so.1
libpython2.6: /usr/lib/libpython2.6.so.1.0

Things seem to be fine rolling back to rubypython 0.5.1 and pygments.rb 0.2.3.

from pygments.rb.

halostatue avatar halostatue commented on June 25, 2024

@lmarburger, I'm not familiar with Heroku, so can you grab the latest rubypython from git (I'm working on 0.6) and give me the output of the following?

require 'rubypython'
p RubyPython::Instance.new({}).library

I'm trying to figure out why things are failing; it worked just fine for me on Ubuntu 11.04 after I installed libpython.

from pygments.rb.

lmarburger avatar lmarburger commented on June 25, 2024

No problem, @halostatue. I grabbed HEAD from https://github.com/halostatue/rubypython and I get NameError: uninitialized constant RubyPython::Instance.

For the record, I think something's broken with python2.7 on their stack. I have an open support ticket, but they haven't repsonded.

irb(main):001:0> require 'rubypython' 
=> true 
irb(main):002:0> RubyPython.start 
LoadError: Could not open library '/usr/local/lib/libpython2.7.a': /usr/local/lib/libpython2.7.a: invalid ELF header

I just use python2.6 in production and everything seems to be fine.

from pygments.rb.

halostatue avatar halostatue commented on June 25, 2024

Please forgive me for being an idiot. It's RubyPython::Interpreter, not
Instance.

I am not surprised that the '.a' is failing.

-a

On Sat, Nov 26, 2011 at 8:21 PM, Larry Marburger <
[email protected]

wrote:

No problem, @halostatue. I grabbed HEAD from
https://github.com/halostatue/rubypython and I get NameError: uninitialized constant RubyPython::Instance.

For the record, I think something's broken with python2.7 on their stack.
I have an open support ticket, but they haven't repsonded.

irb(main):001:0> require 'rubypython'
=> true
irb(main):002:0> RubyPython.start
LoadError: Could not open library '/usr/local/lib/libpython2.7.a':
/usr/local/lib/libpython2.7.a: invalid ELF header

I just use python2.6 in production and everything seems to be fine.


Reply to this email directly or view it on GitHub:
#10 (comment)

Austin Ziegler [email protected] [email protected]
http://www.halostatue.ca/ http://twitter.com/halostatue

from pygments.rb.

lmarburger avatar lmarburger commented on June 25, 2024

That explains it. I figured it was just a typo. Here's the output:

> require 'rubypython'
=> true
> RubyPython::Interpreter.new({}).library
=> "/usr/local/lib/libpython2.7.a"
> RubyPython::Interpreter.new({:python_exe => 'python2.6'}).library
=> nil

from pygments.rb.

 avatar commented on June 25, 2024

I encountered similar issue under Archlinux X86-64. Archlinux does not have a lib64. It has /usr/lib and /usr/lib32...Also, The default python interpreter is python3, so I added RubyPython.configure :python_exe => 'python2.7' in pygments_code.rb.

I have tried both ruby-1.9.2-head and ruby-1.9.3-head, both produced look-alike error message.

My _config.yml

# ----------------------- #
#      Main Configs       #
# ----------------------- #

url: http://capsensitive.github.com
title: Titile
subtitle: A blogging framework for hackers.
author: Author
simple_search: http://google.com/search
description:

# Default date format is "ordinal" (resulting in "July 22nd 2007")
# You can customize the format as defined in
# http://www.ruby-doc.org/core-1.9.2/Time.html#method-i-strftime
# Additionally, %o will give you the ordinal representation of the day
date_format: "ordinal"

# RSS / Email (optional) subscription links (change if using something like Feedburner)
subscribe_rss: /atom.xml
subscribe_email:
# RSS feeds can list your email address if you like
email:

# ----------------------- #
#    Jekyll & Plugins     #
# ----------------------- #

# If publishing to a subdirectory as in http://site.com/project set 'root: /project'
root: /
permalink: /blog/:year/:month/:day/:title/
source: source
destination: public
plugins: plugins
code_dir: downloads/code
category_dir: blog/categories
markdown: rdiscount
pygments: false # default python pygments have been replaced by pygments.rb

paginate: 10          # Posts per page on the blog index
pagination_dir: blog  # Directory base for pagination URLs eg. /blog/page/2/
recent_posts: 5       # Posts in the sidebar Recent Posts section
excerpt_link: "Read on →"  # "Continue reading" link text at the bottom of excerpted articles

titlecase: true       # Converts page and post titles to tilecase

# list each of the sidebar modules you want to include, in the order you want them to appear.
# To add custom asides, create files in /source/_includes/custom/asides/ and add them to the list like 'custom/asides/custom_aside_name.html'
default_asides: [asides/recent_posts.html, asides/github.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html, asides/googleplus.html]

# Each layout uses the default asides, but they can have their own asides instead. Simply uncomment the lines below
# and add an array with the asides you want to use.
# blog_index_asides:
# post_asides:
# page_asides:

Error message in ruby-1.9.3-head

## Generating Site with Jekyll
unchanged sass/screen.scss
Configuration from /home/user/.sync/Dropbox/src/octopress/_config.yml
Building site: source -> public
/home/user/.rvm/gems/ruby-1.9.2-head/gems/ffi-1.0.11/lib/ffi/library.rb:121:in `block in ffi_lib': Could not open library 'lib.so': lib.so: cannot open shared object file: No such file or directory (LoadError)
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `map'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `ffi_lib'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/rubypython-0.5.3/lib/rubypython/python.rb:29:in `'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/rubypython-0.5.3/lib/rubypython/python.rb:21:in `'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/rubypython-0.5.3/lib/rubypython.rb:261:in `load'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/rubypython-0.5.3/lib/rubypython.rb:261:in `reload_library'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/rubypython-0.5.3/lib/rubypython.rb:104:in `start'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/pygments.rb-0.2.4/lib/pygments/ffi.rb:8:in `start'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/pygments.rb-0.2.4/lib/pygments/ffi.rb:82:in `highlight'
        from /home/user/.sync/Dropbox/src/octopress/plugins/pygments_code.rb:27:in `pygments'
        from /home/user/.sync/Dropbox/src/octopress/plugins/pygments_code.rb:17:in `highlight'
        from /home/user/.sync/Dropbox/src/octopress/plugins/backtick_code_block.rb:37:in `block in render_code_block'
        from /home/user/.sync/Dropbox/src/octopress/plugins/backtick_code_block.rb:13:in `gsub'
        from /home/user/.sync/Dropbox/src/octopress/plugins/backtick_code_block.rb:13:in `render_code_block'
        from /home/user/.sync/Dropbox/src/octopress/plugins/octopress_filters.rb:12:in `pre_filter'
        from /home/user/.sync/Dropbox/src/octopress/plugins/octopress_filters.rb:27:in `pre_render'
        from /home/user/.sync/Dropbox/src/octopress/plugins/post_filters.rb:112:in `block in pre_render'
        from /home/user/.sync/Dropbox/src/octopress/plugins/post_filters.rb:111:in `each'
        from /home/user/.sync/Dropbox/src/octopress/plugins/post_filters.rb:111:in `pre_render'
        from /home/user/.sync/Dropbox/src/octopress/plugins/post_filters.rb:166:in `do_layout'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/jekyll-0.11.0/lib/jekyll/post.rb:189:in `render'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/jekyll-0.11.0/lib/jekyll/site.rb:193:in `block in render'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/jekyll-0.11.0/lib/jekyll/site.rb:192:in `each'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/jekyll-0.11.0/lib/jekyll/site.rb:192:in `render'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/jekyll-0.11.0/lib/jekyll/site.rb:40:in `process'
        from /home/user/.rvm/gems/ruby-1.9.2-head/gems/jekyll-0.11.0/bin/jekyll:250:in `'
        from /home/user/.rvm/gems/ruby-1.9.2-head/bin/jekyll:19:in `load'
        from /home/user/.rvm/gems/ruby-1.9.2-head/bin/jekyll:19:in `'

gem infomation (rubypython is 0.5.3)

albino (1.3.3)
blankslate (2.1.2.4)
bundler (1.0.21 ruby)
chunky_png (1.2.5)
classifier (1.3.3)
compass (0.11.6)
directory_watcher (1.4.1)
fast-stemmer (1.0.0)
ffi (1.0.11)
fssm (0.2.7)
haml (3.1.4)
jekyll (0.11.0)
kramdown (0.13.4)
liquid (2.2.2)
maruku (0.6.0)
posix-spawn (0.3.6)
pygments.rb (0.2.4)
rack (1.4.0)
rake (0.9.2.2, 0.9.2)
rb-fsevent (0.4.3.1)
rdiscount (1.6.8)
RedCloth (4.2.9)
rubypants (0.2.0)
rubypython (0.5.3)
sass (3.1.12)
sinatra (1.2.6)
stringex (1.3.0)
syntax (1.0.0)
tilt (1.3.3)
albino (1.3.3)
blankslate (2.1.2.4)
bundler (1.0.21 ruby)
chunky_png (1.2.5)
classifier (1.3.3)
compass (0.11.6)
directory_watcher (1.4.1)
fast-stemmer (1.0.0)
ffi (1.0.11)
fssm (0.2.7)
haml (3.1.4)
jekyll (0.11.0)
kramdown (0.13.4)
liquid (2.2.2)
maruku (0.6.0)
posix-spawn (0.3.6)
pygments.rb (0.2.4)
rack (1.4.0)
rake (0.9.2.2, 0.9.2)
rb-fsevent (0.4.3.1)
rdiscount (1.6.8)
RedCloth (4.2.9)
rubypants (0.2.0)
rubypython (0.5.3)
sass (3.1.12)
sinatra (1.2.6)
stringex (1.3.0)
syntax (1.0.0)
tilt (1.3.3)

from pygments.rb.

Gonzih avatar Gonzih commented on June 25, 2024

I have same issue on archlinux x64

from pygments.rb.

halostatue avatar halostatue commented on June 25, 2024

@capsensitive & @Gonzih, can you try the results of what I asked of @lmarburger in November?

Unfortunately, I won't be able to look at this problem further until after an internet-free vacation that starts on Sunday, but if the new code in HEAD works for discovering the Python library properly, I will try to get a new version of RubyPython out ASAP after I'm done.

from pygments.rb.

Gonzih avatar Gonzih commented on June 25, 2024

I was trying to install rubypython from git using bundler and Gemfile and i got following:

rubypython at /blablabla/fake_path did not have a valid gemspec.
This prevents bundler from installing bins or native extensions, but that may not affect its functionality.
The validation message from Rubygems was:
  ["lib/rubypython/options.rb", "lib/rubypython/pythonexec.rb", ".gemtest"] are not files

After that i was trying to build gem manually from source, but here also was some troubles:

rake gem
rake aborted!
Don't know how to build task 'lib/rubypython/options.rb'

With installed rubypython-0.5.3 i got following output:

1.9.3p0 :001 > require 'rubypython'
 => true 
1.9.3p0 :002 > RubyPython::Interpreter.new({}).library
NameError: uninitialized constant RubyPython::Interpreter
        from (irb):2
        from /home/gnzh/.rvm/rubies/ruby-1.9.3-p0/bin/irb:16:in `<main>'

from pygments.rb.

 avatar commented on June 25, 2024

I installed rubypython via rvm. Rubypython is a dependence for octopress, I use bundle update to install rubypython in octopress dir. No error message during installation.

1.9.2p290 :001 > require 'rubypython'
 => true
1.9.2p290 :002 > RubyPython::Interpreter.new({})
NameError: uninitialized constant RubyPython::Interpreter
        from (irb):2
        from /home/user/.rvm/rubies/ruby-1.9.2-p290/bin/irb:16:in `<main>'

from pygments.rb.

pimvullers avatar pimvullers commented on June 25, 2024

Getting the same error here on Gentoo Linux (trying to run GitLab) with pygments.rb 0.2.3, rubypython 0.5.3 and python 2.7.2 / 3.1.4:

irb(main):003:0> require 'pygments.rb'
=> true
irb(main):004:0> Pygments::Lexer[:bash]
LoadError: Could not open library 'lib.so': lib.so: cannot open shared object file: No such file or directory
    from /usr/local/lib64/ruby/gems/1.9.1/gems/ffi-1.0.11/lib/ffi/library.rb:121:in `block in ffi_lib'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `map'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `ffi_lib'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython/python.rb:29:in `<module:Python>'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython/python.rb:21:in `<top (required)>'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython.rb:261:in `load'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython.rb:261:in `reload_library'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython.rb:104:in `start'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/pygments.rb-0.2.4/lib/pygments/ffi.rb:8:in `start'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/pygments.rb-0.2.4/lib/pygments/ffi.rb:42:in `lexers'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/pygments.rb-0.2.4/lib/pygments/lexer.rb:147:in     `<module:Pygments>'
    from /usr/local/lib64/ruby/gems/1.9.1/gems/pygments.rb-0.2.4/lib/pygments/lexer.rb:1:in `<top (required)>'
    from (irb):4
    from /usr/bin/irb:12:in `<main>'

from pygments.rb.

rolinh avatar rolinh commented on June 25, 2024

Hi there,

I am having the same issue and output as capsensitive on Archlinux (both 64 and 32-bit). rubypython is at version 0.5.3.
Running this:

require 'rubypython'
RubyPython.configure :python_exe => 'python2.7'
p RubyPython::Interpreter.new({}).library

Returns

test.rb:3:in `<main>': uninitialized constant RubyPython::Interpreter (NameError)

Same when setting python_exe to python2.

from pygments.rb.

 avatar commented on June 25, 2024

Hi,

I believe that this lib.so error is due to pygments.rb. I just manually locked pygments.rb to 0.1.3, and octopress can generate pages successfully. Here is the workaround:

  • Workaround:
    Lock the pygments.rb version (0.1.3) in Gemfile. Modify gem 'pygments.rb' to gem 'pygments.rb', '0.1.3. And run bundle install under your octopress working directory.

That workaround should also work under Gentoo, I think. But I have no idea why newer pygments.rb cause trouble only in Archlinux and Gentoo.

from pygments.rb.

rolinh avatar rolinh commented on June 25, 2024

Hi,

I wish I could confirm your workaround but unfortunately, I can't. It actually made things worst.

/home/robin/.rvm/gems/ruby-1.9.2-p290/gems/ffi-1.0.11/lib/ffi/library.rb:121:in `block in ffi_lib': Could not open library 'lib.so': lib.so: cannot open shared object file: No such file or directory (LoadError)
    from /home/robin/.rvm/gems/ruby-1.9.2-p290/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `map'
    from /home/robin/.rvm/gems/ruby-1.9.2-p290/gems/ffi-1.0.11/lib/ffi/library.rb:88:in `ffi_lib'
    from /home/robin/.rvm/gems/ruby-1.9.2-p290/gems/rubypython-0.5.3/lib/rubypython/python.rb:29:in `<module:Python>'
    from /home/robin/.rvm/gems/ruby-1.9.2-p290/gems/rubypython-0.5.3/lib/rubypython/python.rb:21:in `<top (required)>'
    from /home/robin/.rvm/gems/ruby-1.9.2-p290/gems/rubypython-0.5.3/lib/rubypython.rb:261:in `load'
    from /home/robin/.rvm/gems/ruby-1.9.2-p290/gems/rubypython-0.5.3/lib/rubypython.rb:261:in `reload_library'
    from /home/robin/.rvm/gems/ruby-1.9.2-p290/gems/rubypython-0.5.3/lib/rubypython.rb:104:in `start'
    from /home/robin/.rvm/gems/ruby-1.9.2-p290/gems/pygments.rb-0.1.3/lib/pygments/ffi.rb:8:in `start'
    from /home/robin/.rvm/gems/ruby-1.9.2-p290/gems/pygments.rb-0.1.3/lib/pygments/ffi.rb:82:in `highlight'
(and so on...)

Before that, I could rake generate my octopress blog on archlinux but instead of showing codeblocks, it would show the message about missing lib.so on the blog.

from pygments.rb.

Gonzih avatar Gonzih commented on June 25, 2024

I have same situation as @rolinh have.

Here list of my gems:

╰─➤  bundle show                                     1 ↵
Gems included by the bundle:
  * RedCloth (4.2.9)
  * albino (1.3.3)
  * blankslate (2.1.2.4)
  * bundler (1.1.rc)
  * chunky_png (1.2.5)
  * classifier (1.3.3)
  * compass (0.11.6)
  * directory_watcher (1.4.1)
  * fast-stemmer (1.0.0)
  * ffi (1.0.11)
  * fssm (0.2.7)
  * haml (3.1.4)
  * jekyll (0.11.0)
  * kramdown (0.13.4)
  * liquid (2.2.2)
  * maruku (0.6.0)
  * posix-spawn (0.3.6)
  * pygments.rb (0.1.3)
  * rack (1.4.0)
  * rake (0.9.2.2)
  * rb-fsevent (0.4.3.1)
  * rdiscount (1.6.8)
  * rubypants (0.2.0)
  * rubypython (0.5.3)
  * sass (3.1.12)
  * sinatra (1.2.6)
  * stringex (1.3.0)
  * syntax (1.0.0)
  * tilt (1.3.3)

from pygments.rb.

 avatar commented on June 25, 2024

Looks like you have to downgrade rubypython to 0.5.1. Here's my gems:

Gems included by the bundle:
  * RedCloth (4.2.9)
  * albino (1.3.3)
  * blankslate (2.1.2.4)
  * bundler (1.0.21)
  * chunky_png (1.2.5)
  * classifier (1.3.3)
  * compass (0.11.7)
  * directory_watcher (1.4.1)
  * fast-stemmer (1.0.0)
  * ffi (1.0.11)
  * fssm (0.2.8.1)
  * haml (3.1.4)
  * jekyll (0.11.0)
  * kramdown (0.13.4)
  * liquid (2.2.2)
  * maruku (0.6.0)
  * posix-spawn (0.3.6)
  * pygments.rb (0.1.3)
  * rack (1.4.0)
  * rake (0.9.2.2)
  * rb-fsevent (0.4.3.1)
  * rdiscount (1.6.8)
  * rubypants (0.2.0)
  * rubypython (0.5.1)
  * sass (3.1.12)
  * sinatra (1.2.6)
  * stringex (1.3.0)
  * syntax (1.0.0)
  * tilt (1.3.3)

from pygments.rb.

Gonzih avatar Gonzih commented on June 25, 2024

@capsensitive now it works fine, thanks a lot!

from pygments.rb.

 avatar commented on June 25, 2024

It indeed is weird - When I tried to combine pygments.rb 0.1.3 with rubypython 0.5.3, bundle complains that these two gems are not compatible: pygments.rb 0.1.3 requires rubypython 0.5.1. Maybe I was sleepy last night and I misinterpreted that error msg. Sorry.

I actually lock rubypython to 0.5.1 in Gemfile.lock (just figure that out).

Hope that can help. this morning I just pull octopress master and merged it into my own branch, and everything seems alright.

from pygments.rb.

rolinh avatar rolinh commented on June 25, 2024

I tried to rollback rubypython version but I still got the problem. Here is my list of gems:

albino (1.3.3)
blankslate (2.1.2.4)
bundler (1.0.21 ruby)
chunky_png (1.2.5)
classifier (1.3.3)
compass (0.11.7)
directory_watcher (1.4.1)
fast-stemmer (1.0.0)
ffi (1.0.11)
fssm (0.2.8.1)
haml (3.1.4)
jekyll (0.11.0)
kramdown (0.13.4)
liquid (2.2.2)
maruku (0.6.0)
posix-spawn (0.3.6)
pygments.rb (0.1.3)
rack (1.4.0)
rake (0.9.2.2)
rb-fsevent (0.4.3.1)
rb-inotify (0.8.8)
rdiscount (1.6.8)
RedCloth (4.2.9)
rubypants (0.2.0)
rubypython (0.5.1)
sass (3.1.12)
sinatra (1.2.6)
stringex (1.3.0)
syntax (1.0.0)
tilt (1.3.3)

So... same as yours exactly and I still got the same issue.

from pygments.rb.

 avatar commented on June 25, 2024

@rolinh Sorry, I have no idea :-(
What's your ruby version? Mine is 1.9.2-head. Are you using rvm? Have you installed python2-pygments?

Also, Is your octopress up-to-date? I got an older version of octopress from @roylez, which can generate hilight by default, but after bundle update, it can no longer work. I remember I tried to downgrade rake to 0.9.2 (not 0.9.2.2). That's all information I has so far.

from pygments.rb.

rolinh avatar rolinh commented on June 25, 2024

That's OK ;-) Thanks for informing us about a solution that works for you!
Here is my ruby version:
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
And yes, I have python2-pygments (1.4-5)

from pygments.rb.

eldios avatar eldios commented on June 25, 2024

I finally found where was the bug :) it was rubypython's fault and I'm now working flawlessly with pygmente.rb 0.2.4 and rubypython 0.5.3.

I only had to change the following file:
/var/lib/gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython/pythonexec.rb

like so:
-- 126 %x(#{@python} -c "#{command}").chomp if @python
++126 %x("#{@python} -c #{command}").chomp if @python

looks like they completely changed the python execution (at last) and it's quite more effective now. Still this is a pretty decent workaround as for now.. let me knw if this helps anybody of you :)

cheers

from pygments.rb.

rolinh avatar rolinh commented on June 25, 2024

Wow: I can confirm that this fixes the bug! Thank you so much, you made my day!

from pygments.rb.

 avatar commented on June 25, 2024

@eldios It works! Thanks!
though I encounter this message (not an error, since octopress generated site successfully

sh: /usr/bin/python2.7 -c import sys; print '%d.%d' % sys.version_info[:2]: No such file or directory
sh: /usr/bin/python2.7 -c import sys; print sys.prefix: No such file or directory

from pygments.rb.

ab5tract avatar ab5tract commented on June 25, 2024

Hmm, I'm still getting this error using @eldios' workaround. ArchLinux i686. I'm encountering this issue while attempting to require github's Linguist.

from pygments.rb.

ab5tract avatar ab5tract commented on June 25, 2024

My solution was to set @library manually, rather than relying on the find_python_lib method.

I also set python_executable to 'python2' manually. This is all in the gems/1.9.1/gems/rubypython-0.5.3/lib/rubypython/pythonexec.rb file.

from pygments.rb.

rash-pro avatar rash-pro commented on June 25, 2024

I can confirm on Arch x86_64 that the changes made by @ab5stract works just fine!

from pygments.rb.

 avatar commented on June 25, 2024

I'm on Arch x86_64 I had to do two things. First was to follow @eldios advise about patching pythonexec.rb, the second was to do what @ab5tract mentioned.

The reason find_python_lib isn't working is it doesn't know what to even look for. Top of the function has the following.

libbase = "#{FFI::Platform::LIBPREFIX}#{@basename}"
libext = FFI::Platform::LIBSUFFIX

Which should return something like libpython2.7.so, but what I'm getting back is lib.so. So later down the function it's searching for lib.so in each path and when it realizes that doesn't exist it's returning nil.

So when you do @library = "/usr/lib/libpython2.7.so" like mentioned above it's working fine. So that leads to an FFI problem.

from pygments.rb.

29x10 avatar 29x10 commented on June 25, 2024

here is my gem

addressable (2.2.7)
albino (1.3.3)
blankslate (2.1.2.4)
bundler (1.1.3)
chunky_png (1.2.1)
classifier (1.3.3)
compass (0.11.5)
directory_watcher (1.4.0)
fast-stemmer (1.0.0)
ffi (1.0.9)
fssm (0.2.7)
haml (3.1.2)
heroku (2.23.0)
jekyll (0.11.0)
kramdown (0.13.3)
launchy (2.1.0)
liquid (2.2.2)
maruku (0.6.0)
mime-types (1.18)
netrc (0.7.1)
posix-spawn (0.3.6)
pygments.rb (0.1.3)
rack (1.3.2)
rake (0.9.2)
rb-fsevent (0.4.3.1)
rdiscount (1.6.8)
RedCloth (4.2.8)
rest-client (1.6.7)
rubygems-bundler (0.2.8)
rubypants (0.2.0)
rubypython (0.5.1)
rubyzip (0.9.6.1)
sass (3.1.5)
sinatra (1.2.6)
stringex (1.3.0)
syntax (1.0.0)
tilt (1.3.2)
/usr/lib $ls -alh /usr/lib/libpython*so*
-r-xr-xr-x. 1 root root 1.6M Oct 27 09:36 /usr/lib/libpython2.7.so.1.0

after installed python-pygments, it still not working.
then i install the python-devel,it works

from pygments.rb.

29x10 avatar 29x10 commented on June 25, 2024

after install the python-devel

~/octopress $ls -alh /usr/lib/libpython*so*
lrwxrwxrwx  1 root root   19 Apr  2 12:12 /usr/lib/libpython2.7.so -> libpython2.7.so.1.0
-r-xr-xr-x. 1 root root 1.6M Oct 27 09:36 /usr/lib/libpython2.7.so.1.0

from pygments.rb.

akzhan avatar akzhan commented on June 25, 2024

Should be fixed in rubypython 0.6.1 by https://bitbucket.org/raineszm/rubypython/changeset/f63756cd2a4d

Just released today.

from pygments.rb.

akzhan avatar akzhan commented on June 25, 2024

While this PR isn't accepted, fell free to use :git option in Gemfile.

from pygments.rb.

akzhan avatar akzhan commented on June 25, 2024

Just updated GitLabHQ to eliminate this issue using proposed PR #26.

from pygments.rb.

buyhome avatar buyhome commented on June 25, 2024

@capsensitive well done..

from pygments.rb.

kfirlavi avatar kfirlavi commented on June 25, 2024

in octopress I have changed the line in the Gemfile
from:
gem 'pygments.rb', '> 0.2.12'
to:
gem 'pygments.rb', '
> 0.3.2'

then ran:
bundle update

This allow pygments use rubypython 0.6.3

from pygments.rb.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.