Problem with plotting with octave/gnuplot in Jupyter

Using the Octave kernel with Jupyter notebook does not plot any figures.

A cel containing the simple code : plot([1,2],[3,4])
returns the error:

Error message

Inline plot failed, consider trying another graphics toolkit
error: gnuplot_drawnow: the gnuplot terminal, “postscript”, is not available
error: called from
_make_figures>safe_print at line 125 column 7
_make_figures at line 49 column 13

Since gnuplot is called in Octave, is the call corrupt? Or settings not correct?

My system

Windows 10 pro (2004)
octave-5.2.0_1-w64 : GNU Octave, version 5.2.0
Octave was configured for “x86_64-w64-mingw32”.

gp528-win64-mingw : gnuplot 5.2 patchlevel 8
Python 3.7.3
jupyter notebook; octave_kernel + gnuplot_kernel
gnuplot kernel version 0.4.1

As you are using MS Windows, can explain in more detail how you installed Jupyter Notebook? (e.g. I used Miniconda a few months ago).

To my knowledge the gnuplot_kernel is not necessary, only the octave_kernel. Is there a reason for using both? Does it work without the “gnuplot_kernel”? Where is the “gnuplot 5.2 patchlevel 8” located on your system?

Hi, jupyter was installed using pip.
I agree that the gnuplot_kernel should not be necessay. The prblem was the same before installing the gnuplot_kernel.
gnuplot is installed within octave and later on also independly.

It looks like gnuplot is lacking something.
Another solution could be using another plotting tool, but i don’t know how.

Please teach me if I am wrong, but on MS Windows you don’t have the pip command line tool available right from the setup, right? :thinking: For reproducing the issue I would like to know, how you installed and run Python on your MS Windows system (using the Python packaged with Octave, Anaconda, Miniconda,, …).


Together with python, ( Windows installer of python : python-3.7.3-amd64.exe ), pip is installed. Has been updated to:
pip 20.2.3 from c:\localdata\programs installed\python\lib\site-packages\pip (python 3.7)

With the exeption of plotting in the Octave environment (using gnuplot), the kernels of Ocatve and Python are working allright in Jupyter, as well as stand alone.

Thank you for the additional information and sorry for the late reply. I do not always have a MS Windows PC available for testing :innocent:

Using your setup, I can run Jupyter(Lab) on MS Windows 10 (2004) with an Octave 5.2.0 kernel that is able to create plots. Please follow this guide:

  1. Install Octave 5.2.0 MS Windows-64 (recommended)

  2. Install Python 3.8.5 using the Windows x86 web-based installer. I installed for all users and set the PATH variable by the installer.

  3. Open a plain MS Windows cmd.exe and type

    pip install jupyter jupyterlab octave_kernel
    set OCTAVE_EXECUTABLE=C:\Octave\Octave-5.2.0\mingw64\bin\octave-cli.exe
    jupyter lab
  4. Create an Octave Notebook or open an Octave Console (JuptyerLab) and type

    plot (1:10)

Does this setup work for you?

Hi, thanks for your reply.

Unfornuately, the exactly the same error is produced.
In both the notebook as the console.

I’m interested in any other idea’s or options.

Kind regards.

I never worked with Jupyter.
But for Octave to work with all third party programs included in the installer (that includes “gnuplot”), some environment variables have to be set.
Take a look at “octave.vbs” in the directory where Octave is installed to get an idea which those are.


Should the “octave.vbs” be specifically for the octave gui?
Plotting with the normal octave environment is Ok.

The closed plotting environmnet variable is setting gs.exe.
Any idea what to set extra or different for gnuplot finding the missing “postscript” ??

Or how to set another graphics toolkit?

I never worked with Jupyter. That is probably the reason why I don’t understand half of what you are writing.
But if you want to use the “qt” graphics toolkit, you have to use octave-gui.exe. Contrary to its name, it can also be used in CLI mode.

Thanks. I have noticed one can change the plotting program. But I didn’t figure that out yet.
And how to convice the octave kernel to use it in jupyter…

I work quite often with JupyterLab and octave_kernel without problems :innocent:

Unfortunately, octave_kernel is by design forced to use octave-cli, the command-line interface of Octave. Thus Octave’s qt graphics backend can only be used with hacks.

Maybe you can try out some of the magic described in the configuration section

%plot -b inline:fltk

In my limited knowledge with MS Windows, the most healing procedure has always been in the end to really clean out all your previous Octave, Python and kernel installations, make a clean system reboot, and follow my guide above, as it works.

Final idea: is any “AntiVirus” software active blocking binaries to execute?


Thanks for the advice. I’ll try it.


I would expect that it would work with octave-gui if it works with octave-cli. The only difference afaict is that the one is linked with Qt libraries and the other isn’t. Both should provide the same CLI.

Yes, of course it works, I am using it exclusively (and recently with snap installations they use it either) :innocent:

The octave_kernel project just artificially created this limitation to call a program containing “cli” in it’s name because sometimes the GUI might have been started on some systems in the past, probably, when “–gui” was the default in Octave 4.

Well, just trying things. The option plot -b inline:fltk does not bring anything.

plot(1:10) -b inline:fltk

​parse error:
syntax error
plot(1:10) -b inline:fltk
… … … … … ^

​And I tried also with gnuplot:

plot(1:10) -b inline:gnuplot

parse error:
syntax error
plot(1:10) -b inline:gnuplot
… … … … … ^

Perhaps the command is incorrect?

python -m octave_kernel.check:

Octave kernel v0.32.0
Metakernel v0.27.0
Python v3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)]
Python path: C:\LocalData\Programs installed\Python\python.exe

Connecting to Octave…
Octave connection established
Octave Kernel v0.32.0 running GNU Octave v5.2.0
Graphics toolkit: fltk
Available toolkits: [1,1] = fltk
[1,2] = gnuplot

Please follow guides strictly, mind the percentage sign % in front of the command as written in my post :wink:

Keep in mind it is “plot magic”, some IPython stuff, not Octave language.

The issue with fltk is that it doesn’t handle offscreen printing, which is the mechanism by which figures are transfered to the jupyter notebook. In order to have it work I had to modify (in my local version) the octave_kernel startup script so that it doesn’t force the use of octave-cli.

Here are the offending lines that I commented out in (for me it is in ~/anaconda3/lib/python3.7/site-packages/octave_kernel):

if executable:
     executable = which(executable)
     # if 'octave-cli' not in executable:
     #     raise OSError('OCTAVE_EXECUTABLE does not point to an octave-cli file, please see README')
     executable = which('octave-cli')

Then I can start jupyter-lab as :

OCTAVE_EXECUTABLE=/usr/bin/octave jupyter-lab

After switching the toolkit to qt, it just works as expected: