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

OpenStudio Ruby installation not functioning properly

asked 2017-09-28 00:51:46 -0600

Bo gravatar image

updated 2017-09-28 14:12:32 -0600

I followed the Ruby installation instructions here, but when I type irb then require 'openstudio' on the command line, I get this:

irb(main):001:0> require 'openstudio'  
LoadError: 126: The specified module could not be found.   - C:/openstudio-2.2.0/Ruby/openstudio.so  
from C:/openstudio-2.2.0/Ruby/openstudio.rb:55:in `require_relative'  
from C:/openstudio-2.2.0/Ruby/openstudio.rb:55:in `<top (required)>'  
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
from C:/Ruby200-x64/lib/ruby/site_ruby/openstudio.rb:1:in `<top (required)>'  
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
from C:/Ruby200-x64/lib/ruby/2.0.0/rubygems/core_ext/kernel_require.rb:55:in `require'  
from (irb):1  
from C:/Ruby200-x64/bin/irb:12:in `<main>'

My OpenStudio and Ruby installations are both 64 bit and I'm running Windows 10 Pro. My Path environment variable includes C:\openstudio-2.2.0\Ruby, C:\Ruby200-x64\lib, and C:\Ruby200-x64\bin.

Note also that the geometry tab in my OpenStudio application does not work for a model based on an IDF file with geometry.

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
3

answered 2017-09-28 12:22:03 -0600

updated 2017-09-28 15:33:22 -0600

The directions you followed are for earlier versions of OpenStudio.

In OpenStudio v2.+, ruby comes installed with OpenStudio, and the ruby directory lives in the OpenStudio install. When you require 'openstudio', it seems like you are asking your C:\Ruby200-x64 install to access the openstudio file located in your OpenStudio v2.+ install.

In OpenStudio v2.+, instead of adding require 'openstudio' to the top of your ruby script and running ruby foo_script.rb, you can just run openstudio foo_script.rb.

edit flag offensive delete link more

Comments

That instructions are still valid for OpenStudio 2.

shorowit gravatar imageshorowit ( 2017-09-28 17:39:52 -0600 )edit

Thank you, mdahlhausen. I didn't know that ruby comes installed with OpenStudio v2.+. I uninstalled C:\Ruby200-x64. How can I test my OpenStudio Ruby installation? In C:\openstudio-2.2.0\Ruby, I have openstudio.rb and openstudio.so. The files were associated with NotePad++, but I just changed that to openstudio.exe. When I run openstudio 'openstudio.rb', I get still get this:

Error: 126: The specified module could not be found. - C:/openstudio-2.2.0/Ruby/openstudio.so

Bo gravatar imageBo ( 2017-09-28 18:01:54 -0600 )edit

openstudio i̶s̶ ̶a̶n̶ i̶n̶s̶t̶a̶n̶c̶e̶ ̶o̶f̶ ̶r̶u̶b̶y̶ [Edit: per Dan's comment below, has an embedded not-full-featured ruby]; you don't need to call openstudio 'openstudio.rb'. Just put whatever you want to change with the API in a script and run that.

E.g. openstudio my_script_that_does_something_with_the_api.rb

mdahlhausen gravatar imagemdahlhausen ( 2017-09-28 18:37:21 -0600 )edit

If you want to run interactive ruby, you'll still need to link your Ruby200 install to the openstudio directory. Was that your intent? Just running scripts can be called with just openstudio.

mdahlhausen gravatar imagemdahlhausen ( 2017-09-28 18:38:33 -0600 )edit

Thanks, mdahlhausen. I didn't realize openstudio was an instance of ruby. I just wanted to make sure that my OpenStudio installation was complete. I thought my ruby installation was malfunctioning and causing the OpenStudio GUI to not show anything in the Geometry tab of a model I created from a DOE residential prototype building IDF file. I thought IDF importing worked for everything but HVAC, but I have since read some other resources stating that Stories and Geometry also don't import.

Bo gravatar imageBo ( 2017-09-28 19:17:22 -0600 )edit
3

answered 2017-09-28 17:40:15 -0600

shorowit gravatar image

I'm not sure why you don't have C:/openstudio-2.2.0/Ruby/openstudio.so. I have a C:\openstudio-2.2.1\Ruby\openstudio.so. Did you perhaps deselect some components during the installation process?

Also note that you need to use a newer version of Ruby with OpenStudio 2. See https://github.com/NREL/OpenStudio/wi.... Specifically you need ruby 2.2.4.

edit flag offensive delete link more

Comments

Thank you, shorowit. I do have C:\openstudio-2.2.0\Ruby\openstudio.so. The above thread with mdahlhausen resolved my issue. Thanks for that link. If I end up needing to use the ruby API, I'll use the ruby version listed there.

Bo gravatar imageBo ( 2017-09-28 18:28:41 -0600 )edit

I think that was the issue Scott, looks like Ruby 2.0.0 was installed but 2.2.4 is required to work with that version of OpenStudio. The "Cannot find *.so" message doesn't always literally mean it can't find the file, it might mean it can't load it due to wrong version or missing dependencies.

macumber gravatar imagemacumber ( 2017-09-28 22:11:30 -0600 )edit

This page has a list of the version of Ruby compatible with each version of OpenStudio.

macumber gravatar imagemacumber ( 2017-09-28 22:13:57 -0600 )edit

Your Answer

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

Add Answer

 

Question Tools

1 follower

Stats

Asked: 2017-09-28 00:51:46 -0600

Seen: 93 times

Last updated: Sep 28