Gnuplot error

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

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.

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

It runs:

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?

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

Where is the attempts to find the executable made?

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.

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.

The code that launches the executable is Gnuplot.jl/Gnuplot.jl at master · gcalderone/Gnuplot.jl (github.com)

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

This is interesting: the PATH environment variable is not found:
image

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.

Does this look okay?

shell> gnuplot --version                                                                                  
gnuplot 5.4 patchlevel 3

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

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

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?

Seems like that. Here is my output

julia> using Gnuplot

julia> Gnuplot.gpversion()
v"5.4.0"

julia> 

I have

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

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

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

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

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