# Gem install issue

**URL:** <https://forums.sketchup.com/t/gem-install-issue/161013>\
**Category:** Ruby API\
**Created:** [April 16, 2021, 7:29pm UTC](https://forums.sketchup.com/t/gem-install-issue/161013 "2021-04-16T19:29:56Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![diegolocatelli89](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@diegolocatelli89](https://forums.sketchup.com/u/diegolocatelli89)\
**Post date:** [April 16, 2021, 7:29pm UTC](https://forums.sketchup.com/t/gem-install-issue/161013/1 "2021-04-16T19:29:56Z")

</div>

Hey guys,

I’m facing a issue when trying to install a gem ‘rubyzip’ on SU 2021.

Follow the console log:

Gem.install “rubyzip”  
[#\<Gem::Specification:0x000002327a28f150 @extension\_dir=“C:/Users/Us\xFAario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Gems64/extensions/x64-mswin64-140/2.7.0/rubyzip-2.3.0”,  
@full\_gem\_path=“C:/Users/Us\xFAario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Gems64/gems/rubyzip-2.3.0”,  
@cache\_file=nil,  
@gems\_dir=“C:/Users/Us\xFAario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Gems64/gems”,  
@base\_dir=“C:/Users/Us\xFAario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Gems64”,  
@loaded\_from=“C:/Users/Us\xFAario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Gems64/specifications/rubyzip-2.3.0.gemspec”,  
@original\_platform=“ruby”,  
@installed\_by\_version=#\<Gem::Version “3.1.2”\>,  
@autorequire=nil,  
@date=2020-03-14 00:00:00 UTC,  
@deion=nil,  
@email=[“[alex@simonov.me](mailto:alex@simonov.me)”],  
@homepage=“[GitHub - rubyzip/rubyzip: Official Rubyzip repository](http://github.com/rubyzip/rubyzip)”,  
@name=“rubyzip”,  
@post\_install\_message=nil,  
@signing\_key=nil,  
@summary=“rubyzip is a ruby module for reading and writing zip files”,  
@version=#\<Gem::Version “2.3.0”\>,  
@authors=[“Alexander Simonov”],  
@bindir=“bin”, @cert\_chain=,  
@dependencies=[\<Gem::Dependency type=:development name=“coveralls” requirements=“~\> 0.7”\>,  
\<Gem::Dependency type=:development name=“minitest” requirements=“~\> 5.4”\>,  
\<Gem::Dependency type=:development name=“pry” requirements=“~\> 0.10”\>,  
\<Gem::Dependency type=:development name=“rake” requirements=“~\> 12.3, \>= 12.3.3”\>,  
\<Gem::Dependency type=:development name=“rubocop” requirements=“~\> 0.79”\>],  
@executables=,  
@extensions=,  
@extra\_rdoc\_files=,  
@files=[“README.md”, “Rakefile”, “TODO”, “lib/zip.rb”, “lib/zip/central\_directory.rb”, “lib/zip/compressor.rb”, “lib/zip/constants.rb”, “lib/zip/crypto/decrypted\_io.rb”, “lib/zip/crypto/encryption.rb”, “lib/zip/crypto/null\_encryption.rb”, “lib/zip/crypto/traditional\_encryption.rb”, “lib/zip/decompressor.rb”, “lib/zip/deflater.rb”, “lib/zip/dos\_time.rb”, “lib/zip/entry.rb”, “lib/zip/entry\_set.rb”, “lib/zip/errors.rb”, “lib/zip/extra\_field.rb”, “lib/zip/extra\_field/generic.rb”, “lib/zip/extra\_field/ntfs.rb”, “lib/zip/extra\_field/old\_unix.rb”, “lib/zip/extra\_field/universal\_time.rb”, “lib/zip/extra\_field/unix.rb”, “lib/zip/extra\_field/zip64.rb”, “lib/zip/extra\_field/zip64\_placeholder.rb”, “lib/zip/file.rb”, “lib/zip/filesystem.rb”, “lib/zip/inflater.rb”, “lib/zip/input\_stream.rb”, “lib/zip/ioextras.rb”, “lib/zip/ioextras/abstract\_input\_stream.rb”, “lib/zip/ioextras/abstract\_output\_stream.rb”, “lib/zip/null\_compressor.rb”, “lib/zip/null\_decompressor.rb”, “lib/zip/null\_input\_stream.rb”, “lib/zip/output\_stream.rb”, “lib/zip/pass\_thru\_compressor.rb”, “lib/zip/pass\_thru\_decompressor.rb”, “lib/zip/streamable\_directory.rb”, “lib/zip/streamable\_stream.rb”, “lib/zip/version.rb”, “samples/example.rb”, “samples/example\_filesystem.rb”, “samples/example\_recursive.rb”, “samples/gtk\_ruby\_zip.rb”, “samples/qtzip.rb”, “samples/write\_simple.rb”, “samples/zipfind.rb”], @licenses=[“BSD 2-Clause”],  
@metadata={“bug\_tracker\_uri”=\>“[Issues · rubyzip/rubyzip · GitHub](https://github.com/rubyzip/rubyzip/issues)”,  
“changelog\_uri”=\>“[rubyzip/Changelog.md at v2.3.0 · rubyzip/rubyzip · GitHub](https://github.com/rubyzip/rubyzip/blob/v2.3.0/Changelog.md)”,  
“documentation\_uri”=\>“[File: README — Documentation for rubyzip (2.3.0)](https://www.rubydoc.info/gems/rubyzip/2.3.0)”,  
“source\_code\_uri”=\>“[GitHub - rubyzip/rubyzip at v2.3.0](https://github.com/rubyzip/rubyzip/tree/v2.3.0)”,  
“wiki\_uri”=\>“[Home · rubyzip/rubyzip Wiki · GitHub](https://github.com/rubyzip/rubyzip/wiki)”}, @platform=“ruby”, @rdoc\_options=, @require\_paths=[“lib”], @required\_ruby\_version=#\<Gem::Requirement:0x000002327a277528 @requirements=[[“\>=”, #\<Gem::Version “2.4”\>]]\>, @required\_rubygems\_version=#\<Gem::Requirement:0x000002327a2770a0 @requirements=[[“\>=”, #\<Gem::Version “0”\>]]\>, @requirements=, @rubygems\_version=“3.0.3”, @specification\_version=4, @test\_files=, @new\_platform=“ruby”, @full\_name=“rubyzip-2.3.0” rubyzip-2.3.0\>]

after that, when I start SU the follow message shows:

Error on load file C:/Users/Usúario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/CollectionPlugin/CollectionPlugin.rb  
Error: #\<LoadError: cannot load such file – zip\>  
C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/core\_ext/kernel\_require.rb:92:in `require' C:/Program Files/SketchUp/SketchUp 2021/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:92:in `require’  
C:/Users/Usúario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/CollectionPlugin/CollectionPlugin.rb:33:in `<top (required)>' C:/Program Files/SketchUp/SketchUp 2021/Tools/extensions.rb:197:in `require’  
C:/Program Files/SketchUp/SketchUp 2021/Tools/extensions.rb:197:in `load' C:/Users/Usúario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/CollectionPlugin.rb:32:in `register\_extension’  
C:/Users/Usúario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/CollectionPlugin.rb:32:in `<module:CriaPlugin>' C:/Users/Usúario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/CollectionPlugin.rb:14:in `\<top (required)\>’

Has anyone had the same problem?

thank u guys!

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [April 16, 2021, 9:12pm UTC](https://forums.sketchup.com/t/gem-install-issue/161013/2 "2021-04-16T21:12:50Z")

</div>

Please learn how to post code and monospaced error text to the forum:

- [[How to] Post correctly formatted and colorized code on the forum?](https://forums.sketchup.com/t/how-to-post-correctly-formatted-and-colorized-code-on-the-forum/46189)

* * *

> [@diegolocatelli89](#):
>
> after that, when I start SU the follow message shows:
> 
> ```plaintext
> Error on load file C:/Users/Usúario/AppData/Roaming/SketchUp/SketchUp 2021/SketchUp/Plugins/CollectionPlugin/CollectionPlugin.rb
> Error: #<LoadError: cannot load such file – zip>
> 
> ```

The first output you showed, indicates that the gem was correctly installed.

After that callng

```ruby
require 'zip'

```

… should have unshifted the path to the RubyZip gem’s “lib” subfolder into the first position of the **`$LOAD_PATH`** array, and then loaded …  
`"%AppData%/SketchUp/SketchUp 2021/SketchUp/Gems64/gems/rubyzip-2.3.0/lib/zip.rb"`  
… which loads most of the files in the lib’s `"zip"` subfolder.

Following this, the **`Zip`** module should be defined at the top level **`ObjectSpace`**.

I just tried it in SU2021 and it worked fine for me.

Suggest you restart SketchUp and retry.

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [April 16, 2021, 9:19pm UTC](https://forums.sketchup.com/t/gem-install-issue/161013/3 "2021-04-16T21:19:12Z")

</div>

> [@diegolocatelli89](#):
>
> Has anyone had the same problem?

I **have** noted weirdness with the **RubyZip** gem in the past …

> [@How to use a local ruby gem inside a Sketchup Extension](https://forums.sketchup.com/t/how-to-use-a-local-ruby-gem-inside-a-sketchup-extension/76665/10):
>
> rubygems **ASSUMES** that the loader file inside the “lib” subdir has the same name as the gem itself. Sometimes when it does not weird things happen. (An example is the rubyzip gem which has [or used to have] a loader named `"lib/zip.rb"` instead of `"lib/rubyzip.rb"` .)

---

<div class="post-metadata">

**Author:** ![diegolocatelli89](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@diegolocatelli89](https://forums.sketchup.com/u/diegolocatelli89)\
**Post date:** [April 17, 2021, 11:51am UTC](https://forums.sketchup.com/t/gem-install-issue/161013/4 "2021-04-17T11:51:53Z")

</div>

Hi Dan,

thanks for reply and I’ll lern!

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [April 17, 2021, 2:45pm UTC](https://forums.sketchup.com/t/gem-install-issue/161013/5 "2021-04-17T14:45:02Z")

</div>

Let us know if you get it working correctly.

---

<div class="post-metadata">

**Author:** ![MSP\_Greg](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/msp_greg/32/206066_2.png) [@MSP\_Greg](https://forums.sketchup.com/u/MSP_Greg)\
**Post date:** [April 18, 2021, 4:06pm UTC](https://forums.sketchup.com/t/gem-install-issue/161013/6 "2021-04-18T16:06:24Z")

</div>

I also tried installing and requiring the `rubyzip` gem and had no problems. It did dump the specification object for the gem to the console, which some may find confusing.

Re RubyGems, it is a pretty stable stdlib, so most normal operations have worked for a long time.

If a ‘require’ loads a file that doesn’t match a gem name, the method `Gem.try_activate` is called, and it searches all gems for a matching require. If only one match is found, it loads it. Another example is the ‘nio4r’ gem, which loads with `require 'nio'`…

---

<div class="post-metadata">

**Author:** ![diegolocatelli89](https://avatars.discourse-cdn.com/v4/letter/d/ec9cab/32.png) [@diegolocatelli89](https://forums.sketchup.com/u/diegolocatelli89)\
**Post date:** [April 27, 2021, 12:33am UTC](https://forums.sketchup.com/t/gem-install-issue/161013/7 "2021-04-27T00:33:12Z")

</div>

Hi Dan,  
Sorry for the late reply!  
I didn’t find out how to use rubyzip from rubygems (Gem.install), so I downloaded lib  
and I’m using it locally.

Thanks!

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [April 27, 2021, 1:59am UTC](https://forums.sketchup.com/t/gem-install-issue/161013/8 "2021-04-27T01:59:31Z")

</div>

Well it would have been nice to know what your issue was.

---

<div class="post-metadata">

**Author:** ![Renjith](https://avatars.discourse-cdn.com/v4/letter/r/eb9ed0/32.png) [@Renjith](https://forums.sketchup.com/u/Renjith)\
**Post date:** [January 7, 2022, 12:51am UTC](https://forums.sketchup.com/t/gem-install-issue/161013/9 "2022-01-07T00:51:11Z")

</div>

> [@DanRathbun](#):
>
> Following this, the **`Zip`** module should be defined at the top level **`ObjectSpace`**.

Could you please explain a little bit further, because i was experiencing the same issue

---

<div class="post-metadata">

**Author:** ![DanRathbun](https://sea2.discourse-cdn.com/sketchup/user_avatar/forums.sketchup.com/danrathbun/32/500_2.png) [@DanRathbun](https://forums.sketchup.com/u/DanRathbun)\
**Post date:** [January 7, 2022, 3:23am UTC](https://forums.sketchup.com/t/gem-install-issue/161013/10 "2022-01-07T03:23:51Z")

</div>

There is nothing more to explain. Please stay in 1 topic thread.
