Bogdan M.
Bogdan M.

Reputation: 2181

Using gems via Rubygems in windows - path failure

I have installed ruby 1.9.3, with RubyInstaller and DevKit. I installed the required gem I'm looking forward to use, but no matter what I do i can't get it working. I run my program and i get the following runtime erro:

C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/gnuplot-2.6.2/lib/gnuplot.r
b:59:in `gnuplot': gnuplot executable not found on path (RuntimeError)
        from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/gnuplot-2.6.2/
lib/gnuplot.rb:74:in `open'
        from cluster.rb:182:in `<main>'

What have i done wrong? I did try to add require rubygems, run :cmd>> ruby -rubygems ...(params)..., I installed the gem via gem install gem_name in the curent working directorie, but i can't make it find my gems.

PS: I encounter this problem on windows OS.

Solution addition: the path C:....\gnuplot.exe must be added to the PATH variable

Upvotes: 2

Views: 999

Answers (2)

Charles Caldwell
Charles Caldwell

Reputation: 17169

The gnuplot gem is just a wrapper for the actual gnuplot application. This means that the application needs to be installed in order for the gem to work.

Your error mentions line 59 of /lib/gnuplot.rb which is an error raised when the gem attempts to find your system's installation of gnuplot. For Windows, it is looking in your PATH system variable.

If you do not have gnuplot installed prior to using the gem, you can download and install it from its SourceForge files page.

Upvotes: 5

hlh
hlh

Reputation: 2072

From Gnuplot's Rubyforge site:

"If the gnuplot executable for your system is called something other than simply 'gnuplot' then set the RB_GNUPLOT environment variable to the name of the executable. This must either be a full path to the gnuplot command or an executable filename that exists in your PATH environment variable."

I'm guessing the problem is that executables in Windows end with an .exe extension, so the program is looking for something just called 'gnuplot' and isn't finding it. You can try to set RB_GNUPLOT to the full path of the executable on your system. I've had to set environment variables in Windows before, it's possible; just google the solution for you particular OS.

Upvotes: 1

Related Questions