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

Load Error while including "local" gem file #275

Open
KamalPatel365 opened this issue May 5, 2020 · 8 comments
Open

Load Error while including "local" gem file #275

KamalPatel365 opened this issue May 5, 2020 · 8 comments
Labels

Comments

@KamalPatel365
Copy link

KamalPatel365 commented May 5, 2020

LoadError: cannot load such file -- payapi_client
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require'
/usr/local/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:54:in `require'
<main>:2:in `<main>'
/usr/local/lib/ruby/gems/2.3.0/gems/iruby-0.4.0/lib/iruby/backend.rb:44:in `eval'
/usr/local/lib/ruby/gems/2.3.0/gems/iruby-0.4.0/lib/iruby/backend.rb:44:in `eval'
/usr/local/lib/ruby/gems/2.3.0/gems/iruby-0.4.0/lib/iruby/backend.rb:12:in `eval'
/usr/local/lib/ruby/gems/2.3.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:90:in `execute_request'
/usr/local/lib/ruby/gems/2.3.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:49:in `dispatch'
/usr/local/lib/ruby/gems/2.3.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:38:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/iruby-0.4.0/lib/iruby/command.rb:110:in `run_kernel'
/usr/local/lib/ruby/gems/2.3.0/gems/iruby-0.4.0/lib/iruby/command.rb:40:in `run'
/usr/local/lib/ruby/gems/2.3.0/gems/iruby-0.4.0/bin/iruby:5:in `<top (required)>'
/usr/local/bin/iruby:23:in `load'
/usr/local/bin/iruby:23:in `<main>'

### Below is the version of Ruby and RubyGem:

$ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
$bundle -v
Bundler version 1.17.3
$gem -v
3.0.3

@KamalPatel365
Copy link
Author

Anyone any suggestion on this @kojix2

@kojix2
Copy link
Member

kojix2 commented May 19, 2020

Well, there have been a lot of troubles reported about bundler in the past...
A number of contributors have tried to solve these problems.
However, even today, IRuby is not fully integrated with bundler. That's why I was hesitant to reply.

So I'm going to ask a few additional questions, even though I may not be able to solve this problem...

  1. Have you run the bundle install command yet?
  2. Is payapi_client your original gem? Perhaps it's some kind of API client you make to get data from the web service, and that hasn't been open-sourced yet?
  3. Can you call gems other than payapi_client with bundler in Jupyter? I mean, is this problem specific to payapi_client? Or you can not call all the other gem?
  4. Can you call payapi_client with bundle exec irb -r payapi_clinet ? I mean, is this problem specific to IRuby and you can call payapi_client in irb console?
  5. Which do you use? jupyter lab or jupyter notebook or other consoles?
  6. Do you use IRuby with Rails or not?

@KamalPatel365
Copy link
Author

KamalPatel365 commented May 20, 2020

@kojix2 Answer to your question

  1. I executed 'bundle install' but it didn't resolve the error.
  2. Yes 'payapi_client' is original gem and its not opensource. It is local gem.
  3. Yes I am able to call open source and from gem repository but error arises when I tried calling local gem using 'require'
  4. Its issue with 'IRuby'
  5. I am using 'Jupyter Notebook'.
  6. I am using 'IRuby' not rails.

@olleolleolle
Copy link
Contributor

$LOAD_PATH is a Ruby array of paths to look for files to ’require‘ in. Does your path show up in that array? If not, can you add it, and work around your issue?

@KamalPatel365
Copy link
Author

Ok I will try this. Thanks @olleolleolle

@kojix2
Copy link
Member

kojix2 commented May 20, 2020

It was not reproduced in the latest environment.
IRuby 0.4.0 and Ruby 2.7.1

As @olleolleolle suggests, you should check p $LOAD_PATH to see if bundler adds the load path correctly.

@KamalPatel365
Copy link
Author

Ok @kojix2 I will do this

@mrkn mrkn added the question label Sep 22, 2020
@ankane
Copy link
Contributor

ankane commented Jan 3, 2021

Hey @KamalPatel365, I couldn't tell if you've already tried this, but this seems to work for me for local gems with iRuby.

In Gemfile:

gem 'payapi_client', path: 'path/to/payapi_client'

In notebook:

# require all gems
Bundler.require
# or require individually
require "payapi_client"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants