Error: graphics_toolkit: qt toolkit is not available

I created a conda environment on Mac with octave, oct2py and jupyter lab as follows.

conda create --name test
conda activate test
conda install -y -c conda-forge gnuplot 
conda install -y -c conda-forge octave
conda install -y -c conda-forge oct2py
conda install -y -c conda-forge jupyterlab
jupyter lab

I get the following error with any octave command in a Jupyter notebook.

error: graphics_toolkit: qt toolkit is not available
error: called from
graphics_toolkit at line 88 column 5

Any pointers to what might be missing?

Do you use Octave Kernel :: for running Octave-Jupyter-Notebooks? If yes in which version? Starting with the recent version v0.34.0 the qt-toolkit is used as default.

I see. I had 0.34.0 version of octave_kernel in my Conda env which resulted in the error.

oct2py 5.4.3 pyh8a188c0_0 conda-forge
octave 6.4.0 hb9d2791_0 conda-forge
octave_kernel 0.34.0 pyhd8ed1ab_0 conda-forge

The error went away after downgrading to the following

oct2py 5.3.0 pyhd8ed1ab_0 conda-forge
octave 6.4.0 hb9d2791_0 conda-forge
octave_kernel 0.33.1 pyhd8ed1ab_0 conda-forge

Is there a way to use qt from Conda env for the latest oct2py/octave_kernel? I have the following version of qt:

qt 5.12.9 h126340a_4 conda-forge

That error message usually indicates that Octave was either built without Qt or Octave was started by octave-cli. If Octave was built with Qt, make sure to start it with either octave-gui or with octave.
I don’t know enough about conda or jupyter lab to help any further.

Thanks. I downloaded pre-built Octave from Conda. Not sure how to find out whether it was built with Qt.

Browsing that archive, I can’t find an octave-gui in the bin directory. That probably means that it was built without Qt.

Anyway, that error isn’t fatal. You should be able to change to e.g. the (fltk or) gnuplot graphics toolkit with the Octave command graphics_toolkit("gnuplot").

I don’t know which program is trying to change to the (unavailable) graphics toolkit “qt” for you. But maybe that program should first check with available_graphics_toolkits, or just leave the graphics toolkit that Octave selected as being the “best” for the respective setup…

Octave magic cell (%%octave) in Jupyter produces this error each time it is called. graphics_toolkit(“gnuplot”) had no effect. The code however seems to run fine in Jupyter cell. (1) It will be best to build octave with Qt. This will also allow the use of graphics features, (2) Fix octave_kernel to handle missing qt.

Personally, I had very good experience with macOS and Octave installed via Homebrew, though I am not a “native” macOS user. Maybe you can try out replacing your conda Octave setup with the Homebrew one?