-
Notifications
You must be signed in to change notification settings - Fork 90
Description
Hi, I have an issue with metakernel in Octave kernel.
when i run
$ python -m octave_kernel.check
it stalls when instantiating the octave kernel.
output:
Octave kernel v0.36.0
Metakernel v0.30.2
Python v3.12.7 (main, Oct 1 2024, 02:05:46) [GCC 13.3.0]
Python path: /nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/bin/python3.12
Connecting to Octave...
When i then interrupt the process it always throws the same error.
^CTraceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/octave_kernel/check.py", line 14, in <module>
o = OctaveKernel()
^^^^^^^^^^^^^^
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/metakernel/process_metakernel.py", line 53, in __init__
MetaKernel.__init__(self, *args, **kwargs)
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/metakernel/_metakernel.py", line 167, in __init__
self.reload_magics()
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/metakernel/_metakernel.py", line 766, in reload_magics
module.register_magics(self)
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/metakernel/magics/shell_magic.py", line 114, in register_magics
kernel.register_magics(ShellMagic)
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/metakernel/_metakernel.py", line 772, in register_magics
magic = magic_klass(self)
^^^^^^^^^^^^^^^^^
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/metakernel/magics/shell_magic.py", line 16, in __init__
self.start_process()
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/metakernel/magics/shell_magic.py", line 64, in start_process
self.repl = bash()
^^^^^^
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/metakernel/replwrap.py", line 317, in bash
return REPLWrapper(child, prompt_regex, prompt_change_cmd,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/metakernel/replwrap.py", line 99, in __init__
self._expect_prompt()
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/metakernel/replwrap.py", line 131, in _expect_prompt
pos = self.child.expect(expects, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/pexpect/spawnbase.py", line 354, in expect
return self.expect_list(compiled_pattern_list,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/pexpect/spawnbase.py", line 383, in expect_list
return exp.expect_loop(timeout)
^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/pexpect/expect.py", line 169, in expect_loop
incoming = spawn.read_nonblocking(spawn.maxread, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/pexpect/pty_spawn.py", line 500, in read_nonblocking
if (timeout != 0) and select(timeout):
^^^^^^^^^^^^^^^
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/pexpect/pty_spawn.py", line 450, in select
return select_ignore_interrupts([self.child_fd], [], [], timeout)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/03shgnhh9yynhqdqlyqpn6aac962aisa-python3-3.12.7-env/lib/python3.12/site-packages/pexpect/utils.py", line 143, in select_ignore_interrupts
return select.select(iwtd, owtd, ewtd, timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
KeyboardInterrupt
I thought this might be due to Nix putting my binaries in weird directories so i soft linked ( copied ) my bash binary to /bin/bash and /usr/bin/bash. This did not work or change anything. However, bypassing all magic by adding
def register_magics(self, magic_klass):
return []to the OctaveKernel class in kernel.py in octave kernel "fixed" the issue, by removing all the magic :(.
I can see the metakernel uses the which() function to find the correct paths to bash from the user environment, so now i am at a little bit of a loss as to how I could fix this issue (or even where/what the issue is). Any help hints or comments would be appreciated.
to reproduce
- install nix
sh <(curl -L https://nixos.org/nix/install) --daemon
- enable flakes
echo experimental-features = nix-command flakes >> /etc/nix/nix.conf
or
echo experimental-features = nix-command flakes >> ~/.config/nix/nix.conf
- Enter my development environment
nix develop github:fred441a/octave_kernel
- run the python check
python -m octave_kernel.check