# Gnuplot error

**URL:** <https://discourse.julialang.org/t/gnuplot-error/83863>\
**Category:** Performance\
**Tags:** plotting, gnuplot\
**Created:** [July 6, 2022, 10:27pm UTC](https://discourse.julialang.org/t/gnuplot-error/83863 "2022-07-06T22:27:04Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 6, 2022, 10:27pm UTC](https://discourse.julialang.org/t/gnuplot-error/83863/1 "2022-07-06T22:27:04Z")

</div>

I’m now getting these errors with Gnuplot.jl:

```julia
Cound not start a gnuplot process with command "gnuplot". Enabling dry sessions...     

```

How does one debug something like this? I checked, and `gnuplot` can be started from the shell mode and works.

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [July 6, 2022, 11:23pm UTC](https://discourse.julialang.org/t/gnuplot-error/83863/2 "2022-07-06T23:23:20Z")

</div>

Do you have gnuplot installed? What happens when you just type in `gnuplot` in bash?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 12:11am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/3 "2022-07-07T00:11:59Z")

</div>

It runs:

 ![image](https://global.discourse-cdn.com/julialang/original/3X/a/9/a949e9dc059457f849b9ee88d2c1f56d9f00f575.png)

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [July 7, 2022, 1:51am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/4 "2022-07-07T01:51:52Z")

</div>

That’s interesting. well the error is telling you it can’t find the gnuplot binary so might be issues with your `PATH` variable or something like that. Are you by any chance running WSL/WSL2?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 1:53am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/5 "2022-07-07T01:53:07Z")

</div>

I don’t get it. The Julia executable runs in a bash. The shell mode clearly can find the gnuplot executable.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 1:55am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/6 "2022-07-07T01:55:26Z")

</div>

Where is the attempts to find the executable made?

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [July 7, 2022, 1:55am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/7 "2022-07-07T01:55:32Z")

</div>

Can you post more information? What version of windows, what terminal, are you running WSL/WSL2?.

> Where is the attempts to find the executable made?

I don’t know but will certainly take a look for you.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 1:56am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/8 "2022-07-07T01:56:09Z")

</div>

Windows 10. Sublime Text runs in a Git bash. Here is the same attempt made in a Terminus running first a bash (which can find gnuplot), then julia, which cannot find the executable apparently.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/f/8/f87f4115874efce06fa969c4dc34aa40dfce2447.png)

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [July 7, 2022, 2:00am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/9 "2022-07-07T02:00:05Z")

</div>

The code that launches the executable is [Gnuplot.jl/Gnuplot.jl at master · gcalderone/Gnuplot.jl (github.com)](https://github.com/gcalderone/Gnuplot.jl/blob/master/src/Gnuplot.jl#L1374)

Thanks for the information… seems normal, could you paste the relevant code from the julia script ?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 2:00am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/10 "2022-07-07T02:00:18Z")

</div>

This is interesting: the PATH environment variable is not found:  
 ![image](https://global.discourse-cdn.com/julialang/original/3X/3/1/31cce4f0b8d46f9273cc75d42565162277a9a164.png)

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [July 7, 2022, 2:01am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/11 "2022-07-07T02:01:21Z")

</div>

That’s probably the issue then. The path variable may only be defined for specific shells. Can you try setting the PATH in the Windows `environmental variables` GUI.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 2:05am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/12 "2022-07-07T02:05:09Z")

</div>

Does this look okay?

```julia
shell> gnuplot --version                                                                                  
gnuplot 5.4 patchlevel 3

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 2:05am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/13 "2022-07-07T02:05:56Z")

</div>

PATH: It is actually set. And it does include `gnuplot` path.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 2:07am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/14 "2022-07-07T02:07:48Z")

</div>

I tweaked the function a little bit, and I’m getting:

```julia
julia> function gpversion()                                                                               
           icmd = `gnuplot --version`                                                                     
                                                                                                          
           @show proc = open(`$icmd`, read=true)                                                          
           @show s = String(read(proc))                                                                   
           if !success(proc)                                                                              
               error("An error occurred while running: " * string(icmd))                                  
           end                                                                                            
                                                                                                          
           s = split(s, " ")                                                                              
           ver = ""                                                                                       
           for token in s                                                                                 
               try                                                                                        
                   @show ver = VersionNumber("$token")                                                    
                   break                                                                                  
               catch                                                                                      
               end                                                                                        
           end                                                                                            
                                                                                                          
           if ver < v"5.0"                                                                                
               error("gnuplot ver. >= 5.0 is required, but " * string(ver) * " was found.")               
           end                                                                                            
           return ver                                                                                     
       end                                                                                                
gpversion (generic function with 1 method)                                                                
                                                                                                          
julia> gpversion()
proc = open(`$icmd`, read = true) = Process(`gnuplot --version`, ProcessRunning)                          
s = String(read(proc)) = ""    

```

So it looks like the reading from the process failed?

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [July 7, 2022, 2:09am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/15 "2022-07-07T02:09:15Z")

</div>

Seems like that. Here is my output

```julia
julia> using Gnuplot

julia> Gnuplot.gpversion()
v"5.4.0"

julia> 

```

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 2:10am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/16 "2022-07-07T02:10:17Z")

</div>

I have

```julia
julia> proc = open(`gnuplot --version`, read = true)                                                      
Process(`gnuplot --version`, ProcessRunning)                                                              
                                                                                                          
julia> String(read(proc))                                                                                 
""              

```

---

<div class="post-metadata">

**Author:** ![affans](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/affans/32/11911_2.png) [@affans](https://discourse.julialang.org/u/affans)\
**Post date:** [July 7, 2022, 2:11am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/17 "2022-07-07T02:11:17Z")

</div>

What about using just powershell or cmd? Do you have Windows Terminal as well? Maybe there is something weird with Sublime/git bash?

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 2:18am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/18 "2022-07-07T02:18:16Z")

</div>

From an ad hoc Powershell, running independently of the editor.

 ![image](https://global.discourse-cdn.com/julialang/original/3X/0/7/07ab3d0828392d4c6405e7f9d8c586ac6631432f.png)

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 2:27am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/19 "2022-07-07T02:27:46Z")

</div>

> [@PetrKryslUCSD](#):
>
> `String(read(proc))`

The key seems to be reading from the process: I am getting an empty string.

---

<div class="post-metadata">

**Author:** ![PetrKryslUCSD](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/petrkryslucsd/32/215825_2.png) [@PetrKryslUCSD](https://discourse.julialang.org/u/PetrKryslUCSD)\
**Post date:** [July 7, 2022, 3:42am UTC](https://discourse.julialang.org/t/gnuplot-error/83863/20 "2022-07-07T03:42:45Z")

</div>

The correct version can be obtained with gnuplot 5.2.8, but not with the newest (5.4.3). The plotting works just fine with 5.2.8.

See also: [How do I debug this error? · Issue #58 · gcalderone/Gnuplot.jl · GitHub](https://github.com/gcalderone/Gnuplot.jl/issues/58)

[Next page](https://discourse.julialang.org/t/gnuplot-error/83863.md?page=2)
