I installed the irbtools gem, but I can't require it.
$ sudo gem1.9.1 install irbtools
Successfully installed irbtools-0.8.7
1 gem installed
Installing ri documentation for irbtools-0.8.7...
Building YARD (yri) index for irbtools-0.8.7...
Installing RDoc documentation for irbtools-0.8.7...
$ gem1.9.1 which irbtools # yup, installed OK
/var/lib/gems/1.9.1/gems/irbtools-0.8.7/lib/irbtools.rb
$ ls /var/lib/gems/1.9.1/gems/irbtools-0.8.7/lib/
irbtools irbtools.rb
$ ruby1.9.1 -e 'require "irbtools"'
<internal:lib/rubygems/custom_require>:33:in `require': no such file to load -- irbtools (LoadError)
from <internal:lib/rubygems/custom_require>:33:in `rescue in require'
from <internal:lib/rubygems/custom_require>:29:in `require'
from -e:1:in `<main>'
It doesn't work in irb1.9.1 either. All other gems in /var/lib/gems/1.9.1/gem seem to be working fine. Now I'm kinda dumbstruck.
Can anyone please help me track down what's going on? I'm not necessarily looking for a solution, but just an idea what to do to debug the problem.
I'm on Debian Squeeze with
$ ruby1.9.1 --version
ruby 1.9.2p180 (2011-02-18 revision 30909) [i486-linux]
This error is quite strange... I haven't got a debian here, but a generic solution would be to use rvm or build ruby from source.
Hints for debugging the problem:
Does requiering or loading /var/lib/gems/1.9.1/gems/irbtools-0.8.7/lib/irbtools.rb directly work?
Do your ruby binary and your gem binary really refer to the same installation?
Can irbtools be found with the Gem.source_index method?: Gem.source_index.gems.keys.grep /irbtools/
Related
on a mac os 10.12.6 after i try sudo gem install rake or
i get this error message:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rubygems/core_ext/kernel_warn (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.0.0/rubygems.rb:1395:in `<top (required)>'
from <internal:gem_prelude>:1:in `require'
from <internal:gem_prelude>:1:in `<compiled>'
The is error throws any gem install
Ruby version is 2.0.0, Ive tried updating ruby with homebrew but whni try installing home brew i get the same error.
Cant seem to edit /Library/Ruby/Site/2.0.0/rubygems.rb:1395
This is possibly related to issue #2535 in rubygems fixed in release 3.0.1.
Try gem update --system
All suggested solutions didn't fully work for me, although gem update --system seems to be a good idea, because it updates ruby. BUT: On my Mac, the system version didn't step back after the update, although ruby -v gave the correct new version. The described error remained for me, e.g. while using homebrew with brew update:
$ brew update
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- rubygems/core_ext/kernel_warn (LoadError)
from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Library/Ruby/Site/2.3.0/rubygems.rb:1395:in `<top (required)>'
from <internal:gem_prelude>:4:in `require'
from <internal:gem_prelude>:4:in `<internal:gem_prelude>'
The only thing that helped me was the following as described here:
sudo rm -f '/usr/local/bin/update_rubygems'
sudo rm -rf '/Library/Ruby/Site/2.3.0'
Hope to help some folks (I'am on MacOS 10.14.2).
You are going to have problems using system ruby or messing with it's gems. You are far better off to use a ruby version manager where you may have different versions of ruby per project. I highly recommend RVM.
See here for how to install
Did you also try to run gem install bundler?
Post output of these commands if they don't give you an error
ruby -v
which ruby
gem env
I can install charlock_holmes gem on opensuse, trying to open it up in irb quickly, I get this:
> irb
2.3.0 :001 > require 'charlock_holmes'
LoadError: /home/wpostma/.rvm/gems/ruby-2.3.0/gems/charlock_holmes-0.7.3/lib/charlock_holmes/charlock_holmes.so:
undefined symbol: _ZTIN6icu_538ByteSinkE - /home/wpostma/.rvm/gems/ruby-2.3.0/gems/charlock_holmes-0.7.3/lib/charlock_holmes/charlock_holmes.so
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/wpostma/.rvm/gems/ruby-2.3.0/gems/charlock_holmes-0.7.3/lib/charlock_holmes.rb:1:in `<top (required)>'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from (irb):1
from /home/wpostma/.rvm/rubies/ruby-2.3.0/bin/irb:11:in `<main>'
2.3.0 :002 >
It looks to me like maybe something in charlock_holmes is incompatible with the libicu version inside tumbleweed.
I'm using ruby installed with rvm, and purging all my gemsets and reinstalling does not fix it. Any other ways to get charlock_holmes to work? Maybe I need to install a special copy of libicu (earlier, older) and point the gem at it?
Either of these works. For me the bundle config option works better.
This is a direct command to install the gem, directing it towards the correct libicu version:
gem install charlock_holmes -- --with-icu-dir=/usr/local
This is a command to tell which ever ruby project I install later on this system, will get gems installed by bundler to just work instead of breaking:
bundle config build.charlock_holmes "--with-icu-dir=/usr/local" --global
Since I'm using rvm the above bundle configuration seems to be "global" to that rvm environment only.
In my case, the bundle config is helpful as a large series of actions that would have otherwise failed (installing gems, and bootstrapping a large rails application) just worked.
I'm using Archlinux, the ruby location was on /usr/bin/ruby
$ ruby --version
ruby 2.0.0p247 (2013-06-27 revision 41674) [i686-linux]
$ gem install ffi
Building native extensions. This could take a while...
Successfully installed ffi-1.9.0
Parsing documentation for ffi-1.9.0
Done installing documentation for ffi after 41 seconds
1 gem installed
I was using G-WAN to execute a ruby script, but when i use require 'ffi' this output shown:
/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- ffi (LoadError)
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/asd/bin/gwan_linux32-bit/127.0.0.1_8081/#127.0.0.1/csp/test.rb:1:in `<main>'
and require '/home/asd/.gem/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi.rb' shows:
/usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require': cannot load such file -- ffi_c (LoadError)
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/asd/.gem/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi.rb:14:in `rescue in <top (required)>'
from /home/asd/.gem/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi.rb:3:in `<top (required)>'
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /usr/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:45:in `require'
from /home/asd/bin/gwan_linux32-bit/127.0.0.1_8081/#127.0.0.1/csp/test.rb:21:in `<main>'
the output of p $LOAD_PATH was:
["/usr/lib/ruby/site_ruby/2.0.0" # doesn't exists
, "/usr/lib/ruby/site_ruby/2.0.0/i686-linux" # doesn't exists
, "/usr/lib/ruby/site_ruby" # doesn't exists
, "/usr/lib/ruby/vendor_ruby/2.0.0" # doesn't exists
, "/usr/lib/ruby/vendor_ruby/2.0.0/i686-linux" # doesn't exists
, "/usr/lib/ruby/vendor_ruby" # doesn't exists
, "/usr/lib/ruby/2.0.0"
, "/usr/lib/ruby/2.0.0/i686-linux"
]
the location for FFI was:
$ locate ffi.rb
/home/asd/.gem/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi.rb
/home/asd/.gem/ruby/2.0.0/gems/ffi-1.9.0/lib/ffi/ffi.rb
/opt/jruby/lib/ruby/shared/ffi.rb
/opt/jruby/lib/ruby/shared/ffi/ffi.rb
/opt/jruby/samples/ffi/ffi.rb
so i tried to add the directory to $LOAD_PATH
$LOAD_PATH.unshift '/home/asd/.gem/ruby/2.0.0/gems/ffi-1.9.0/lib'
and now require 'ffi' shows no error..
if i already have many gems installed on ~/.gem/ruby/2.0.0/gems
$ ll ~/.gem/ruby/2.0.0/gems/ | wc
285 2558 17502
what is the correct way to use the gem? is it by adding each path to $LOAD_PATH
This is clearly a Ruby configuration issue, and the suggested RVM tool seems to address it:
RVM is a command-line tool which allows you to easily install, manage,
and work with multiple ruby environments from interpreters to sets of
gems.
As suggested by 'icktoofay', G-WAN could add support for RVM, but I am not sure that it makes sense unless RVM becomes more mainstream than Ruby itself (or assimilated by Ruby).
Now, Jesly Varghese also told us (above) that the issue comes from the fact "you are using system ruby, and calling a gem in user dir".
Did you try to install G-WAN under /opt/gwan ?
Then, this PATH issue may be gone.
Update: This issue has been fixed using the RubyInstaller and related DevKit. Please see the answer below.
On a new WinXP we are trying to setup RoR. We were having some issue making the rails application run. While debugging Hpricot gem was found the culprit. The same issue happens if we use the Hpricot in a simple Ruby program.
A message box appears with the following message when we run any Ruby program which is using Hpricot:
The procedure entry point rb_hash_lookup could not be located in the dynamic link library msvcrt-ruby18.dll.
And here is the stack trace:
C:/Ruby/lib/ruby/gems/1.8/gems/hpricot-0.8.6-x86-mswin32/lib/hpricot_scan/1.8/hpricot_scan.so: 127: The specified procedure could not be found.
- C:/Ruby/lib/ruby/gems/1.8/gems/hpricot-0.8.6-x86-mswin32/lib/hpricot_scan/1.8/hpricot_scan.so (LoadError)
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/Ruby/lib/ruby/gems/1.8/gems/hpricot-0.8.6-x86-mswin32/lib/hpricot_scan.rb:1
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from C:/Ruby/lib/ruby/gems/1.8/gems/hpricot-0.8.6-x86-mswin32/lib/hpricot.rb:20
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from hp_test.rb:3
Ruby: ruby 1.8.6 (2008-08-11 patchlevel 287) [i386-mswin32]
Ruby Gems: 1.3.2
Hpricot: 0.8.6 (it was installed using gem install hpricot without any issue)
Any clue?
Thanks.
Ruby DevKit was the rescuer here. Thanks to Charlas.
What we did is:
1. Uninstalled the ruby
2. Installed it again using RubyInstaller
3. Installed the DevKit
4. Install the hpricot gem
5. That's it
You need another hpricot: 0.6.164 is ok, while 0.8.6 is not.
The latter might be meant for the 1.8.7+ ruby.
I've somehow broken my ruby configuration, and I'm not sure how to fix it. Here's an irb session:
>> require 'ruby-debug'
LoadError: dlsym(0x101a272d0, Init_ruby_debug): symbol not found - /opt/local/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle
from /opt/local/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.3/lib/ruby_debug.bundle
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/local/lib/ruby/gems/1.8/gems/ruby-debug-base-0.10.3/lib/ruby-debug-base.rb:1
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
from /opt/local/lib/ruby/gems/1.8/gems/ruby-debug-0.10.3/cli/ruby-debug.rb:5
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
from /opt/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:36:in `require'
from (irb):1
Here's my ruby version:
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-darwin10]
I'm not sure how to go about diagnosing and fixing this. Any suggestions? What other info should I provide?
Reinstalling the gem didn't fix it:
$ sudo gem install ruby-debug
Password:
Successfully installed ruby-debug-0.10.3
1 gem installed
Installing ri documentation for ruby-debug-0.10.3...
Installing RDoc documentation for ruby-debug-0.10.3...
maybe it's missing some dependency .so file? I would use ldd -l to determine this in linux, dunno about mac.
Doing a fresh install of 1.8.7 via rvm fixed this problem for me.