Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question
0

LoadError: irb require 'openstudio'

asked 2023-02-04 12:30:08 -0500

krkh-1702's avatar

updated 2023-02-05 14:52:02 -0500

Hello,

I am trying to use the OpenStudio SDK with Interactive Ruby (IRB) through cmd, but I get this error. Do you have any advice on how to solve this? Should I be using the correct version of Ruby? I made sure I installed both Ruby and OpenStudio(x64).

irb(main):003:0> require 'openstudio'
<internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require': cannot load such file -- C:openstudio-3.4.0Rubyopenstudio.rb (LoadError)
        from <internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from C:/Ruby31-x64/lib/ruby/site_ruby/openstudio.rb:1:in `<top (required)>'
        from <internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from <internal:C:/Ruby31-x64/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
        from (irb):3:in `<main>'
        from C:/Ruby31-x64/lib/ruby/gems/3.1.0/gems/irb-1.4.1/exe/irb:11:in `<top (required)>'
        from C:/Ruby31-x64/bin/irb:33:in `load'
        from C:/Ruby31-x64/bin/irb:33:in `<main>'
irb(main):004:0>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2023-02-05 17:21:12 -0500

You need to make it so openstudio.rb is in your Ruby search path. There are several ways to do this. You can set the RUBYLIB environment variable to include the path you the openstudio.rb you want to include. I personally write a file named openstudio.rb to my Ruby installation's lib\ruby\site_ruby directory which loads the openstudio.rb I want from an absolute path. For example, I have the file C:\Ruby27-x64\lib\ruby\site_ruby\openstudio.rb which has as content:

require 'C:\openstudioapplication-1.5.0\Ruby\openstudio.rb'
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Careers

Question Tools

1 follower

Stats

Asked: 2023-02-04 12:30:08 -0500

Seen: 121 times

Last updated: Feb 13 '23