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

Couldn't spawn gnuplot. Make sure it is installed and available in PATH #49

Open
hasanAjsf opened this issue Sep 10, 2019 · 3 comments
Open

Comments

@hasanAjsf
Copy link

While running the example:

// This file is released into Public Domain.
use gnuplot::*;
use std::f32;

fn main()
{
	let mut fg = Figure::new();
	let mut x = vec![];
	for i in 0..100i32
	{
		x.push(i as f32 * 0.1 - 5.0);
	}

	let mut t = 0.0;
	fg.set_terminal("gif animate optimize delay 2 size 480,360", "fg.gif.gif");
	for i in 0..100
	{
		if i > 0
		{
			fg.new_page();
		}
		let ax = fg.axes2d().set_y_range(Fix(-1.0), Fix(1.0));
		ax.lines(
			x.iter(),
			x.iter()
				.map(|&x| (x + t as f32 * 0.1 * 2. * f32::consts::PI).sin()),
			&[Color("blue")],
		);
		ax.lines(
			x.iter(),
			x.iter()
				.map(|&x| (x + t as f32 * 0.1 * 2. * f32::consts::PI).cos()),
			&[Color("red")],
		);
		t += 0.1;
	}
	fg.echo_to_file("fg.gif.gnuplot");
	fg.show();
}

I got the error:

    Finished dev [unoptimized + debuginfo] target(s) in 0.20s
     Running `target\debug\rust.exe`
thread 'main' panicked at 'Couldn't spawn gnuplot. Make sure it is installed and available in PATH.: Os { code: 2, kind: NotFound, message: "The system cannot find the file specified." }', src\libcore\result.rs:1165:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
error: process didn't exit successfully: `target\debug\rust.exe` (exit code: 101)

Knowing that I've gnuplot and it is installed in my Win 10 machine, and added to the path:

image

@fodil-a
Copy link

fodil-a commented Sep 18, 2019

It failed because it tries to execute the command gnuplot --version, and could not find gnuplot in your path.
Can you please try to execute that same command by hand ?

@hasanAjsf
Copy link
Author

@fodil-a

It gave:

PS C:\Users\hasan.DESKTOP-HU2FQ29> gnuplot --version
gnuplot 5.2 patchlevel 7

@vn971
Copy link
Contributor

vn971 commented Jan 9, 2020

You also need to make sure the rust process (and the library) have the updated PATH environment when trying to call gnuplot. Restarting the computer would do the trick. (I guess it has been been done long ago already, so if gnuplot is still installed, it should just work.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants