5

openstudio-standards gem path problem

I've built and installed the openstudio-standards gem, but although OpenStudio can find the measure, I get the following error when trying to apply it.

    dyld: warning, LC_RPATH @executable_path/../lib in /Applications/OpenStudio 1.10.0/Ruby/openstudio/openstudiosdd.bundle being ignored in restricted program because of @executable_path
/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 -- openstudio-standards (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 /private/var/folders/gs/9ltb1x5s3xd69zyybll7sjnh0000gn/T/OpenStudio.V30370/ApplyMeasureNow/UserScript/user_script.rb:5:in `<class:CreateDOEPrototypeBuilding>'
    from /private/var/folders/gs/9ltb1x5s3xd69zyybll7sjnh0000gn/T/OpenStudio.V30370/ApplyMeasureNow/UserScript/user_script.rb:3:in `<top (required)>'
    from in.rb:103:in `load'
    from in.rb:103:in `<main>'
Script executing from: /private/var/folders/gs/9ltb1x5s3xd69zyybll7sjnh0000gn/T/OpenStudio.V30370/ApplyMeasureNow/UserScript
Found argument 'building_type' with value 'SmallOffice'.
Found argument 'template' with value '90.1-2010'.
Found argument 'climate_zone' with value 'ASHRAE 169-2006-2A'.

Does anyone either recognize the problem or know how to debug this from within OpenStudio? E.g., how can I tell where OpenStudio is looking for gems and what path I am missing in my PATH variable?

__AmirRoth__'s avatar
4.4k
__AmirRoth__
asked 2016-01-18 09:21:29 -0500, updated 2016-01-19 20:58:59 -0500
edit flag offensive 0 remove flag close merge delete

Comments

Alternatively, is it possible to run the measure as a non-gem?

__AmirRoth__'s avatar __AmirRoth__ (2016-01-18 12:57:53 -0500) edit
add a comment see more comments

2 Answers

5

It looks like OpenStudio is using system Ruby (not sure why). Try this.

In your openstudio-standards checkout and build the ruby gem:

cd <path-to-openstudio-standards-root>/openstudio-standards
bundle
rake build

Then use system ruby to install the gem:

sudo /usr/bin/gem install <path-to-openstudio-standards-root>/openstudio-standards/openstudio-standards-0.1.0.gem

I did try using --user-install option to avoid sudo, but for some reason that didn't work.

In OpenStudio run "Apply Measure Now" and it just worked.

long's avatar
409
long
answered 2016-01-19 10:14:53 -0500
rpg777's avatar
7k
rpg777
updated 2016-01-19 10:45:50 -0500
edit flag offensive 0 remove flag delete link

Comments

If you use the user install you need to set GEM_PATH to the location where the gem was installed locally. It is weird that Ruby doesn't automatically do this for you but it doesn't.

macumber's avatar macumber (2016-01-19 10:29:13 -0500) edit

Nick, you are the man. As you know I was tripped up by this last week as well. Your workaround here worked a treat for me.

rpg777's avatar rpg777 (2016-01-19 10:36:09 -0500) edit

@macumber, I did add GEM_PATH when I first hit this (GEM_PATH=/Users/rgugliel/.gem/ruby/2.0.0), but still no go until I tried Nick's advice here.

rpg777's avatar rpg777 (2016-01-19 10:39:03 -0500) edit

Hmm, well installing the gem to a particular Ruby install will only install the gem to that instance of Ruby. The user directory solution is preferred because it would work across multiple versions of Ruby (e.g. system and OS version). Sounds like the steps need to be tweaked for Macs, I've only tested on Windows.

macumber's avatar macumber (2016-01-19 10:59:02 -0500) edit

Thanks, Ruby-Wan Kenobi!

__AmirRoth__'s avatar __AmirRoth__ (2016-01-19 11:01:33 -0500) edit
add a comment see more comments
2

I was waiting for @aparker to comment but I believe this is the prefered way to install the standards gem. Basically you install it in a user location and then set GEM_PATH (which is separate from RUBY_PATH) to this location. The gem will be loaded from your user location before any other location:

  1. Check out https://github.com/NREL/openstudio-st...
  2. cd \openstudio-standards\openstudio-standards
  3. bundle install
  4. rake build
  5. gem install --user-install pkg/openstudio-standards-0.1.0.gem
  6. Set environment variable GEM_PATH to the user gem directory, e.g. C:\Users\dmacumbe.gem\ruby\2.0.0
macumber's avatar
12k
macumber
answered 2016-01-19 10:27:49 -0500
edit flag offensive 0 remove flag delete link

Comments

1

Step 6 is the step in question. That doesn't work for me and I haven't looked into exactly why yet. Granted I have 5 versions of Ruby on my machine.

long's avatar long (2016-01-19 10:55:04 -0500) edit
add a comment see more comments