octave_kernel
octave_kernel copied to clipboard
instruct Jupyter to run Octave code on the Octave flatpack app
Ubuntu 19.10 repository provides an outdated old 4.4 version of Octave, how do I instruct Jupyter to use Octave flatpack app to run Octave Code
Does the flatpack app have a /bin
dir or otherwise have an octave-cli
executable in it? If so, you can point your OCTAVE_EXECUTABLE
environment variable to that executable.
@blink1073 flatpack Octave can enter the CLI mode as follows
joseph@joseph-X541UJ:~/Downloads$ flatpak run org.octave.Octave
Gtk-Message: 00:49:45.102: Failed to load module "canberra-gtk-module"
Gtk-Message: 00:49:45.102: Failed to load module "canberra-gtk-module"
GNU Octave, version 5.1.0
Copyright (C) 2019 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.
Octave was configured for "x86_64-pc-linux-gnu".
Additional information about Octave is available at https://www.octave.org.
Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html
Read https://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.
octave:1> x = 5
x = 5
octave:2>
and please show me step by step how to edit the OCTAVE_EXECUTABLE
environment variable I'm very beginner , just learned Jupyter notebook today
as for bin files for flatpack app I can't exactly locate it
Does the flatpack app have a
/bin
dir or otherwise have anoctave-cli
executable in it? If so, you can point yourOCTAVE_EXECUTABLE
environment variable to that executable.
edit I have located the bin files
joseph@joseph-X541UJ:/var/lib/flatpak/exports/bin$ pwd
/var/lib/flatpak/exports/bin
joseph@joseph-X541UJ:/var/lib/flatpak/exports/bin$ ./org.octave.Octave
Gtk-Message: 01:21:52.023: Failed to load module "canberra-gtk-module"
Gtk-Message: 01:21:52.023: Failed to load module "canberra-gtk-module"
GNU Octave, version 5.1.0
Copyright (C) 2019 John W. Eaton and others.
This is free software; see the source code for copying conditions.
There is ABSOLUTELY NO WARRANTY; not even for MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.
Octave was configured for "x86_64-pc-linux-gnu".
Additional information about Octave is available at https://www.octave.org.
Please contribute if you find this software useful.
For more information, visit https://www.octave.org/get-involved.html
Read https://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.
octave:1>
What is the output of:
echo $SHELL
ls /var/lib/flatpak/exports/bin
What is the output of:
echo $SHELL ls /var/lib/flatpak/exports/bin
here is the output @blink1073
joseph@joseph-X541UJ:/var/lib/flatpak/exports/bin$ echo $SHELL
/bin/bash
joseph@joseph-X541UJ:/var/lib/flatpak/exports/bin$ ls /var/lib/flatpak/exports/bin
org.octave.Octave
You should be able to add:
export OCTAVE_EXECUTABLE=/var/lib/flatpak/exports/bin/org.octave.Octave
To the end of your ~/.bashrc
file, and then run the following to see if it worked:
source ~/.bashrc
jupyter console --kernel octave
You should be able to add:
export OCTAVE_EXECUTABLE=/var/lib/flatpak/exports/bin/org.octave.Octave
To the end of your
~/.bashrc
file, and then run the following to see if it worked:source ~/.bashrc jupyter console --kernel octave
@blink1073 it gives me this error message
joseph@joseph-X541UJ:~$ jupyter console --kernel octave
[MetaKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "/home/joseph/.local/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/home/joseph/.local/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 654, in kernel_info_request
content.update(self.kernel_info)
File "/home/joseph/.local/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 647, in kernel_info
'language_info': self.language_info,
File "/home/joseph/.local/lib/python3.7/site-packages/octave_kernel/kernel.py", line 78, in language_info
'version': self.language_version,
File "/home/joseph/.local/lib/python3.7/site-packages/octave_kernel/kernel.py", line 69, in language_version
ver = self.octave_engine.eval('version', silent=True)
File "/home/joseph/.local/lib/python3.7/site-packages/octave_kernel/kernel.py", line 96, in octave_engine
logger=self.log)
File "/home/joseph/.local/lib/python3.7/site-packages/octave_kernel/kernel.py", line 170, in __init__
self.executable = self._get_executable()
File "/home/joseph/.local/lib/python3.7/site-packages/octave_kernel/kernel.py", line 453, in _get_executable
raise OSError('OCTAVE_EXECUTABLE does not point to an octave-cli file, please see README')
OSError: OCTAVE_EXECUTABLE does not point to an octave-cli file, please see README
[MetaKernelApp] ERROR | Exception in message handler:
Traceback (most recent call last):
File "/home/joseph/.local/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 268, in dispatch_shell
yield gen.maybe_future(handler(stream, idents, msg))
File "/home/joseph/.local/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 654, in kernel_info_request
content.update(self.kernel_info)
File "/home/joseph/.local/lib/python3.7/site-packages/ipykernel/kernelbase.py", line 647, in kernel_info
'language_info': self.language_info,
File "/home/joseph/.local/lib/python3.7/site-packages/octave_kernel/kernel.py", line 78, in language_info
'version': self.language_version,
File "/home/joseph/.local/lib/python3.7/site-packages/octave_kernel/kernel.py", line 69, in language_version
ver = self.octave_engine.eval('version', silent=True)
File "/home/joseph/.local/lib/python3.7/site-packages/octave_kernel/kernel.py", line 96, in octave_engine
logger=self.log)
File "/home/joseph/.local/lib/python3.7/site-packages/octave_kernel/kernel.py", line 170, in __init__
self.executable = self._get_executable()
File "/home/joseph/.local/lib/python3.7/site-packages/octave_kernel/kernel.py", line 453, in _get_executable
raise OSError('OCTAVE_EXECUTABLE does not point to an octave-cli file, please see README')
OSError: OCTAVE_EXECUTABLE does not point to an octave-cli file, please see README
Traceback (most recent call last):
File "/home/joseph/.local/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 336, in init_kernel_info
reply = self.client.get_shell_msg(timeout=1)
File "/home/joseph/.local/lib/python3.7/site-packages/jupyter_client/client.py", line 77, in get_shell_msg
return self.shell_channel.get_msg(*args, **kwargs)
File "/home/joseph/.local/lib/python3.7/site-packages/jupyter_client/blocking/channels.py", line 57, in get_msg
raise Empty
_queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/joseph/.local/bin/jupyter-console", line 10, in <module>
sys.exit(main())
File "/home/joseph/.local/lib/python3.7/site-packages/jupyter_core/application.py", line 268, in launch_instance
return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
File "/home/joseph/.local/lib/python3.7/site-packages/traitlets/config/application.py", line 663, in launch_instance
app.initialize(argv)
File "</home/joseph/.local/lib/python3.7/site-packages/decorator.py:decorator-gen-117>", line 2, in initialize
File "/home/joseph/.local/lib/python3.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
return method(app, *args, **kwargs)
File "/home/joseph/.local/lib/python3.7/site-packages/jupyter_console/app.py", line 142, in initialize
self.init_shell()
File "/home/joseph/.local/lib/python3.7/site-packages/jupyter_console/app.py", line 115, in init_shell
confirm_exit=self.confirm_exit,
File "/home/joseph/.local/lib/python3.7/site-packages/traitlets/config/configurable.py", line 412, in instance
inst = cls(*args, **kwargs)
File "/home/joseph/.local/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 282, in __init__
self.init_kernel_info()
File "/home/joseph/.local/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 339, in init_kernel_info
raise RuntimeError("Kernel didn't respond to kernel_info_request")
RuntimeError: Kernel didn't respond to kernel_info_request