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

Could not open library 'lib.so': lib.so: cannot open shared object file: No such file or directory (LoadError) #704

Closed
navaneeth opened this Issue Aug 8, 2012 · 15 comments

Comments

Projects
None yet
8 participants
@navaneeth

navaneeth commented Aug 8, 2012

When I do rake generate, I am getting the following error. This happens only when I embed code inside the post. Simple posts without any code works fine. Gist embedding also works fine.

I am using Archlinux. Any help would be appreciated

Building site: source -> public/libvarnam
File "", line 1
import sys; print sys.executable
^
SyntaxError: invalid syntax
sh: - : invalid option
Usage: sh [GNU long option] [option] ...
sh [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--restricted
--verbose
--version
Shell options:
-irsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
sh: - : invalid option
Usage: sh [GNU long option] [option] ...
sh [GNU long option] [option] script-file ...
GNU long options:
--debug
--debugger
--dump-po-strings
--dump-strings
--help
--init-file
--login
--noediting
--noprofile
--norc
--posix
--protected
--rcfile
--restricted
--verbose
--version
Shell options:
-irsD or -c command or -O shopt_option (invocation only)
-abefhkmnptuvxBCHP or -o option
/home/nkn/.rvm/gems/ruby-1.9.3-p194/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/nkn/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/lib/ffi/library.rb:88:inmap'
from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/ffi-1.0.11/lib/ffi/library.rb:88:in ffi_lib' from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/rubypython-0.5.3/lib/rubypython/python.rb:29:inmodule:Python'
from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/rubypython-0.5.3/lib/rubypython/python.rb:21:in <top (required)>' from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/rubypython-0.5.3/lib/rubypython.rb:261:inload'
from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/rubypython-0.5.3/lib/rubypython.rb:261:in reload_library' from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/rubypython-0.5.3/lib/rubypython.rb:104:instart'
from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/pygments.rb-0.2.13/lib/pygments/ffi.rb:8:in start' from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/pygments.rb-0.2.13/lib/pygments/ffi.rb:82:inhighlight'
from /home/nkn/open_source/octopress/plugins/pygments_code.rb:24:in pygments' from /home/nkn/open_source/octopress/plugins/pygments_code.rb:14:inhighlight'
from /home/nkn/open_source/octopress/plugins/backtick_code_block.rb:37:in block in render_code_block' from /home/nkn/open_source/octopress/plugins/backtick_code_block.rb:13:ingsub'
from /home/nkn/open_source/octopress/plugins/backtick_code_block.rb:13:in render_code_block' from /home/nkn/open_source/octopress/plugins/octopress_filters.rb:12:inpre_filter'
from /home/nkn/open_source/octopress/plugins/octopress_filters.rb:28:in pre_render' from /home/nkn/open_source/octopress/plugins/post_filters.rb:112:inblock in pre_render'
from /home/nkn/open_source/octopress/plugins/post_filters.rb:111:in each' from /home/nkn/open_source/octopress/plugins/post_filters.rb:111:inpre_render'
from /home/nkn/open_source/octopress/plugins/post_filters.rb:166:in do_layout' from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/lib/jekyll/post.rb:189:inrender'
from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/lib/jekyll/site.rb:193:in block in render' from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/lib/jekyll/site.rb:192:ineach'
from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/lib/jekyll/site.rb:192:in render' from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/lib/jekyll/site.rb:40:inprocess'
from /home/nkn/.rvm/gems/ruby-1.9.3-p194/gems/jekyll-0.11.2/bin/jekyll:250:in <top (required)>' from /home/nkn/.rvm/gems/ruby-1.9.3-p194/bin/jekyll:23:inload'
from /home/nkn/.rvm/gems/ruby-1.9.3-p194/bin/jekyll:23:in `

'

@navaneeth

This comment has been minimized.

Show comment
Hide comment
@navaneeth

navaneeth Aug 8, 2012

It happens only if I have something like

```[shell]
code

navaneeth commented Aug 8, 2012

It happens only if I have something like

```[shell]
code
@nileshgr

This comment has been minimized.

Show comment
Hide comment
@nileshgr

nileshgr Aug 8, 2012

It's a problem with pygments and I'm facing this as well. Temporary solution is to use back tick and plaintext blocks for posting code. Search around, there are a few issues.

Here are the relevant links:
#610
tmm1/pygments.rb#10

nileshgr commented Aug 8, 2012

It's a problem with pygments and I'm facing this as well. Temporary solution is to use back tick and plaintext blocks for posting code. Search around, there are a few issues.

Here are the relevant links:
#610
tmm1/pygments.rb#10

@nileshgr

This comment has been minimized.

Show comment
Hide comment
@nileshgr

nileshgr Aug 8, 2012

I have found a temporary, and bad fix for this. Edit ~/.gem/ruby/1.9.1/gems/rubypython-0.5.3/lib/rubypython/pythonexec.rb

And change line number 26:

@realname = "/usr/bin/python2.7" #File.join(@dirname, "#{basename}#{@version.gsub(/\./, '')}")

You must replace the binary path using your interpreter (if it's 2.6 or whatever).

No flames on me please, I would have posted a diff directly, but I don't know single bit of Ruby

nileshgr commented Aug 8, 2012

I have found a temporary, and bad fix for this. Edit ~/.gem/ruby/1.9.1/gems/rubypython-0.5.3/lib/rubypython/pythonexec.rb

And change line number 26:

@realname = "/usr/bin/python2.7" #File.join(@dirname, "#{basename}#{@version.gsub(/\./, '')}")

You must replace the binary path using your interpreter (if it's 2.6 or whatever).

No flames on me please, I would have posted a diff directly, but I don't know single bit of Ruby

@imathis

This comment has been minimized.

Show comment
Hide comment
@imathis

imathis Aug 8, 2012

Owner

@navaneeth @nileshgr This is definitely something that the folks at Pygments.rb and RubyPython need to work out. This is beyond my depth as I have no authority over those projects.

Owner

imathis commented Aug 8, 2012

@navaneeth @nileshgr This is definitely something that the folks at Pygments.rb and RubyPython need to work out. This is beyond my depth as I have no authority over those projects.

@imathis imathis closed this Aug 8, 2012

@nileshgr

This comment has been minimized.

Show comment
Hide comment
@nileshgr

nileshgr Aug 8, 2012

So I guess we're left with this static, but "just-works" fix for now.

nileshgr commented Aug 8, 2012

So I guess we're left with this static, but "just-works" fix for now.

@navaneeth

This comment has been minimized.

Show comment
Hide comment
@navaneeth

navaneeth Aug 8, 2012

@nileshgr I have Python 3.2.3. Looks like updating like you told is not working. It looks like it won't work with latest version of python.

navaneeth commented Aug 8, 2012

@nileshgr I have Python 3.2.3. Looks like updating like you told is not working. It looks like it won't work with latest version of python.

@nileshgr

This comment has been minimized.

Show comment
Hide comment
@nileshgr

nileshgr Aug 8, 2012

@navaneeth it doesn't work with Python 3.2, I tried that. Install python2 as well, which should be supported by your distro. A lot of apps still depend on Python 2.

nileshgr commented Aug 8, 2012

@navaneeth it doesn't work with Python 3.2, I tried that. Install python2 as well, which should be supported by your distro. A lot of apps still depend on Python 2.

@navaneeth

This comment has been minimized.

Show comment
Hide comment
@navaneeth

navaneeth Aug 8, 2012

@nileshgr You are right. I got it working with Python 2.7. Thanks for your suggestion.

navaneeth commented Aug 8, 2012

@nileshgr You are right. I got it working with Python 2.7. Thanks for your suggestion.

dhedlund added a commit to dhedlund/octopress that referenced this issue Aug 29, 2012

Force python 2.*, needed for rubypython gem via pygments.rb gem (imat…
…his#704)

INTERIM BUGFIX FOR: imathis#704
an upstream solution is in the works but, as of 2012-08-29, the pygment.rb
gem has yet to incorporate necessary changes and release a new gem:
tmm1/pygments.rb#10

Added code that tries to ensure that, when the 'python' command
is executed, it always returns an interpreter for version 2.* of python,
regardless of what the system-wide default version of python is.  When the
system-wide version of python is not 2.* and a compatible version is found,
a .pygments-cache/python-bin/python symlink is created which points to the
compatible version.  The python-bin directory is then added to the PATH
which gives priority to locally identified version.

Tried to make cross-platform but have limited systems to test with, can be
disabled by setting environment variable FORCE_PYTHON2=0
@dhedlund

This comment has been minimized.

Show comment
Hide comment
@dhedlund

dhedlund Aug 29, 2012

If anyone is having issues due to multiple versions of python (python3), instead of modifying any gems, the issue can also be addressed by creating a symlink to your 2.7 version of python and then make the symlinked version of "python" is in your path ahead of python3's. For example:

mkdir python-bin
ln -s /usr/bin/python2 python-bin/python
PATH=$PWD/python-bin:$PATH rake generate

I've submitted a patch as part of pull request #733 which is basically an automated version of the above. Please comment in the pull request if the fix works for you and what environment you tested it on.

dhedlund commented Aug 29, 2012

If anyone is having issues due to multiple versions of python (python3), instead of modifying any gems, the issue can also be addressed by creating a symlink to your 2.7 version of python and then make the symlinked version of "python" is in your path ahead of python3's. For example:

mkdir python-bin
ln -s /usr/bin/python2 python-bin/python
PATH=$PWD/python-bin:$PATH rake generate

I've submitted a patch as part of pull request #733 which is basically an automated version of the above. Please comment in the pull request if the fix works for you and what environment you tested it on.

@nileshgr

This comment has been minimized.

Show comment
Hide comment
@nileshgr

nileshgr Aug 29, 2012

@dhedlund nice workaround. This is actually a problem with the rubypython gem upstream, and you seem to know ruby, why don't you submit a patch there? I've just started learning ruby.

nileshgr commented Aug 29, 2012

@dhedlund nice workaround. This is actually a problem with the rubypython gem upstream, and you seem to know ruby, why don't you submit a patch there? I've just started learning ruby.

@dhedlund

This comment has been minimized.

Show comment
Hide comment
@dhedlund

dhedlund Sep 10, 2012

@nileshgr A pull request has already been submitted upstream by @akzhan which fixes part of the issue. It has bee
n sitting upstream for about 3 months now.
tmm1/pygments.rb#28

There are actually multiple upstream issues with both pygments.rb and rubypython, including incomplete or corrupt searches of libpython*.{so,dll} files on some environments, not guessing the python version associated with the interpreter correctly and not being able to configure the python_exe outside pygments.rb, contrary to documentation.

All of the python interpreter/libpython.* issues I've seen have already been addressed in rubypython gem 0.6.1, but the latest official release of the pygments.rb gem is hardcoded to rubypython 0.5.x and does not expose a way to specify python 2.7 w/o modifying the gem directly. @akzhan's commits address both these issues upstream. Once his changes are accepted and a new gem released, some people will still have declare the python version manually as the pygments.rb gem doesn't presume any particular version of python.

dhedlund commented Sep 10, 2012

@nileshgr A pull request has already been submitted upstream by @akzhan which fixes part of the issue. It has bee
n sitting upstream for about 3 months now.
tmm1/pygments.rb#28

There are actually multiple upstream issues with both pygments.rb and rubypython, including incomplete or corrupt searches of libpython*.{so,dll} files on some environments, not guessing the python version associated with the interpreter correctly and not being able to configure the python_exe outside pygments.rb, contrary to documentation.

All of the python interpreter/libpython.* issues I've seen have already been addressed in rubypython gem 0.6.1, but the latest official release of the pygments.rb gem is hardcoded to rubypython 0.5.x and does not expose a way to specify python 2.7 w/o modifying the gem directly. @akzhan's commits address both these issues upstream. Once his changes are accepted and a new gem released, some people will still have declare the python version manually as the pygments.rb gem doesn't presume any particular version of python.

@aknosis

This comment has been minimized.

Show comment
Hide comment
@aknosis

aknosis Oct 3, 2012

I solved this problem by installing python-devel on Fedora 17.

aknosis commented Oct 3, 2012

I solved this problem by installing python-devel on Fedora 17.

@lotreal

This comment has been minimized.

Show comment
Hide comment
@lotreal

lotreal Nov 28, 2012

Thanks aknosis, Solved this problem by installing python-devel on CentOS 6.3.

lotreal commented Nov 28, 2012

Thanks aknosis, Solved this problem by installing python-devel on CentOS 6.3.

@Khvalin

This comment has been minimized.

Show comment
Hide comment
@Khvalin

Khvalin Dec 27, 2012

Thanks guys, installing python-devel worked on openSuSe as well

Khvalin commented Dec 27, 2012

Thanks guys, installing python-devel worked on openSuSe as well

@hron84

This comment has been minimized.

Show comment
Hide comment
@hron84

hron84 commented Jan 30, 2013

Thanks @aknosis

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