Install Prawn gem in SketchUp 2016


#1

Hi All,

When I trying to install prawn gem in SketchUp 2016, it’s showing error.

Gem::install "prawn"
Error: #<Gem::SpecificGemNotFoundException: Could not find a valid gem 'prawn' (>= 0) locally or in a repository>
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/dependency_installer.rb:301:in `find_spec_by_name_and_version'
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/dependency_installer.rb:110:in `available_set_for'
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems/dependency_installer.rb:322:in `install'
C:/Program Files/SketchUp/SketchUp 2016/Tools/RubyStdLib/rubygems.rb:526:in `install'
<main>:in `<main>'
SketchUp:1:in `eval'

Anyone, please help me for install prawn gem in sketchup 2016.

Thanks,
Siva S


#2

I wasn’t able to install in SU2016 either.

I was however able to installer in newer SU versions, SU2017 and SU2018.

My guess is that the rubygems version in SU2016 is too old to connect to the RubyGems repository. (I’m actually surprised there isn’t an error in that respect.)

I’m not sure if you are able to patch it, the gems system inside a desktop application is a tricky thing.

Note that the gem system isn’t something we’re supporting. There are number of issues with using it in SU.

  • We’re not able to apply patches to RubyGems for older SU versions. So whenever they make changes that require an update to RubyGems we’re stuck.
  • We’ve been struggling with OpenSSL issues over the years. Certificates getting out of date eventually, which suffer the same problem with RubyGems in that we cannot provide a patch. There’s also been bugs in Ruby that’s caused issues.
  • When OpenSSL have worked, in the current versions on Windows it can cause SU to hang/freeze for a very long time (many minutes). (This should be fixed in newer OpenSSL versions, but for that we’ll need to upgrade Ruby inside of SU)
  • If using gems for an extension you plan to publish, then you’d risk clashing with other extensions trying to use a different version of the gem.
  • Some gems require compilation, which under Windows require DevKit. This isn’t available on users machines. Nor is DevKit able to detect SketchUp’s Ruby.

Our recommendation if you want to use gems for your extension development is:

  • Use standalone Ruby (matching the versions for your target SketchUp) and install the gem there. Then you can copy the gem to your extension.
  • Make sure to wrap the gem into your own namespace so you don’t clash with other extensions. (If you only use it for your own development then you don’t need to do that step.)

How to use a local ruby gem inside a Sketchup Extension
#3

I have prawn v 2.1.0 installed into SketchUp 2016 appraently successfully.
It is the last version of prawn before they bumped the required Ruby version up to 2.1.
It seems I installed it back in May of 2016.

If I type …

require "prawn"

… at the console I get true returned.

So, try this …

Gem::install( "prawn", "2.1.0" )

#4

Ah, yea. Ruby 2.0 have long since reached end of life and Ruby community in general is starting to drop support. (One of the reasons why we updated to Ruby 2.2 in SketchUp 2017)