RustGnuplot icon indicating copy to clipboard operation
RustGnuplot copied to clipboard

Problem when installing through cargo

Open austincarrig opened this issue 8 years ago • 3 comments

I'm trying to use version 0.0.20 of rustgnuplot through Cargo, and when I try to cargo run the program through my Terminal I get this error:

thread '<main>' panicked at 'Couldn't spawn gnuplot. Make sure it is installed
                              and available in PATH.', ../src/libcore/option.rs:335

It builds fine with cargo build, but breaks when the program runs.

I saw issues #11 and #12 which deal with this exact problem, but I'm not quite sure what is meant by "make sure it is installed and available in PATH". My code in main.rs is just your example:

extern crate gnuplot;

use gnuplot::{Figure, Caption, Color};

fn main() {
    let x = [0u32, 1, 2];
    let y = [3u32, 4, 5];
    let mut fg = Figure::new();
    fg.axes2d()
    .lines(&x, &y, &[Caption("A line"), Color("black")]);
    fg.show();
}

Any idea what could be causing this error? I'm really new to Rust and Cargo, but I thought Cargo was supposed to handle all of this for me. Thanks in advance for your help!

austincarrig avatar Feb 29 '16 23:02 austincarrig

RustGnuplot works by launching the gnuplot process (i.e. the thing described here: http://www.gnuplot.info/) and communicating with it, so you need to install gnuplot separately (it's commonly packaged on Linux, and there are downloads for Windows as well).

I'll see what I can do about making that clearer.

SiegeLord avatar Mar 01 '16 03:03 SiegeLord

on debian x based linuxes you can install this with:

sudo apt-get install gnuplot gnuplot-x11

scriptandcompile avatar Mar 03 '16 08:03 scriptandcompile

i have the same problem,......

songroom2016 avatar Nov 12 '17 14:11 songroom2016

IMO just a mention about in-advance manual GNUPlot installation is enough. For instance, Windows version is hosted at https://sourceforge.net/projects/gnuplot/files/gnuplot/ as a binary and perfectly works after installation or manual placing the binary to the Path.

snuk182 avatar Jul 16 '18 12:07 snuk182