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

--bundle option does not work after Ruby 3.2.2 update #5161

Closed
kbenne opened this issue Apr 22, 2024 · 5 comments
Closed

--bundle option does not work after Ruby 3.2.2 update #5161

kbenne opened this issue Apr 22, 2024 · 5 comments
Assignees
Labels
Triage Issue needs to be assessed and labeled, further information on reported might be needed

Comments

@kbenne
Copy link
Contributor

kbenne commented Apr 22, 2024

This does not work...

cd src/cli/test/bundle
bundle  _2.4.10_  install --path ./test_gems
../../../../build/Products/openstudio  --bundle Gemfile  --bundle_path './test_gems' test.rb
@kbenne kbenne added the Triage Issue needs to be assessed and labeled, further information on reported might be needed label Apr 22, 2024
@kbenne kbenne self-assigned this Apr 22, 2024
kbenne added a commit that referenced this issue Apr 22, 2024
@kbenne
Copy link
Contributor Author

kbenne commented Apr 23, 2024

Update. It looks like a gemfile that has a github source may still not work after the most recent commit. For example.

source 'http://rubygems.org'
gem 'tilt', github: 'rtomayko/tilt'

@kbenne
Copy link
Contributor Author

kbenne commented Apr 23, 2024

@wenyikuang @jmarrec

@wenyikuang
Copy link
Collaborator

kbenne added a commit that referenced this issue Apr 23, 2024
@wenyikuang
Copy link
Collaborator

wenyikuang commented Apr 25, 2024

Maybe found another bundler related issue:

when I am updating openstudio-extension-gems I faced an issue:

[ruby] <Error> Error activating gem :/ruby/3.2.0/specifications/addressable-2.8.1.gemspec
[ruby] <Error> Error activating gem :/ruby/3.2.0/specifications/parallel-1.19.1.gemspec

Easiest way to re-produce:(using docker image nrel/openstudio:develop)
OS: ubuntu 20.04

openstudio --version
3.8.0-beta+276859dd1e
ruby --version
ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x86_64-linux]
git clone --branch wenyi-fix-build-temp https://github.com/NREL/openstudio-extension-gem .

(This branch basically just pointing the dependencies to the github repo instead of the ruby-gems which we haven't pulished)

Then in the directory of openstudio-extension-gem

bundle _2.4.10_ install
bundle _2.4.10_ exec rake spec

(It may raise exception for /usr/local/lib/ruby/gems/3.2.0/gems/bundler-2.4.10/lib/bundler/source/path.rb:209:in load_spec_files': The path /test/.bundle/install/ruby/3.2.0/bundler/gems/OpenStudio-measure-tester-gem-89b9b7eb5f2d does not exist. (Bundler::PathError)in the first run, if so need to install the dependencies again bybundle 2.4.10 install`)

Then we will find the issue:

SYSTEM CALL:
/usr/local/openstudio-3.8.0-beta/bin/openstudio --bundle '/test/Gemfile' --bundle_path '/test/.bundle/install/' run -w '/test/spec/test/runner/in.osw' 2>&1 > "/test/spec/test/runner/in.osw.log"
Error running command: '/usr/local/openstudio-3.8.0-beta/bin/openstudio --bundle '/test/Gemfile' --bundle_path '/test/.bundle/install/' run -w '/test/spec/test/runner/in.osw' 2>&1 > "/test/spec/test/runner/in.osw.log"'
stdout: Failed to run workflow. Last Error:
  Found error in state 'OpenStudioMeasures' with message: 'ArgumentError: Trying to register Bundler::GemfileError for status code 4 but Bundler::GemfileError is already registered'

And if we cat the log file it will raise:

cat /test/spec/test/runner/run.log
[02:53:05.408529 ERROR] [ruby] Error activating gem :/ruby/3.2.0/specifications/addressable-2.8.1.gemspec
[02:53:05.409099 ERROR] [ruby] Error activating gem :/ruby/3.2.0/specifications/parallel-1.19.1.gemspec

And if we re-run the SYSTEM CALL:

/usr/local/openstudio-3.8.0-beta/bin/openstudio --bundle '/test/Gemfile' --bundle_path '/test/.bundle/install/' run -w '/test/spec/test/runner/in.osw'

System output:

Warn: Bundle activated but ENV['BUNDLE_WITHOUT'] is not set
Info: Setting BUNDLE_WITHOUT to 'test'
[ruby] <Error> Error activating gem :/ruby/3.2.0/specifications/addressable-2.8.1.gemspec
[ruby] <Error> Error activating gem :/ruby/3.2.0/specifications/parallel-1.19.1.gemspec
ExpandObjects Started.
No expanded file generated.
ExpandObjects Finished. Time:     0.007
EnergyPlus Completed Successfully.
RunEnergyPlus: Completed Successfully with 0 Fatal Errors, 0 Severe Errors, 15 Warnings.

The Error stack is re-producable.

If we make a new empty Gemfile and run with the same osw file, the error will gone.

However, if we add parallel as dependencies like in Gemfile

source 'http://rubygems.org'
gem 'parallel'

and

bundle  _2.4.10_  install --path ./test_gems
openstudio --bundle Gemfile --bundle_path './test_gems' run -w '/openstudio-extensions/spec/test/runner/in.osw' 

It will raise the same exceptions

The content of the osw is:

cat spec/test/runner/in.osw
{
  "seed_file": null,
  "weather_file": "openstudio-extension-gem-test.epw",
  "measure_paths": [
    "/openstudio-extensions/lib/measures"
  ],
  "file_paths": [
    "/openstudio-extensions/lib/files"
  ],
  "run_directory": "/openstudio-extensions/spec/test/runner",
  "steps": [
    {
      "measure_dir_name": "openstudio_extension_test_measure",
      "arguments": {
      }
    }
  ],
  "name": "Test File",
  "description": "Test File"
}

Some guess:

Error activating gem :/ruby/3.2.0/specifications/parallel-1.19.1.gemspec

@kbenne
Copy link
Contributor Author

kbenne commented Apr 25, 2024

I can reproduce all of this. I think these messages

[02:53:05.408529 ERROR] [ruby] Error activating gem :/ruby/3.2.0/specifications/addressable-2.8.1.gemspec
[02:53:05.409099 ERROR] [ruby] Error activating gem :/ruby/3.2.0/specifications/parallel-1.19.1.gemspec

are probably mostly benign and also expected. Some of the gem dependencies are pulling in addressable (2.8.6), but openstudio-gems is pinned to 2.8.1 because of an issue. The error message is stemming from here, which basically just means what it says, we can't activate an embedded gem because the bundle has pulled in a competing version.

I'm not sure about the source of the original error though.

'ArgumentError: Trying to register Bundler::GemfileError for status code 4 but Bundler::GemfileError is already registered'

Still trying to sort it out.

kbenne added a commit to NREL/openstudio-extension-gem that referenced this issue Apr 26, 2024
@jmarrec jmarrec closed this as completed May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Triage Issue needs to be assessed and labeled, further information on reported might be needed
Projects
None yet
Development

No branches or pull requests

3 participants