SciRuby / iruby

Official gem repository: Ruby kernel for Jupyter/IPython Notebook
https://github.com/SciRuby/iruby
MIT License
901 stars 29 forks source link

Any syntax error leads to crash of iruby on mac #268

Closed Stvad closed 4 years ago

Stvad commented 4 years ago

Hi, I'm experiencing the following issue - if the command I'm trying to execute has any syntax errors that's going to crash the kernel.

Example:

 ✘  /Users/sitalov  iruby
Could not load bundler: Could not locate Gemfile or .bundle/ directory
[TerminalIPythonApp] WARNING | Subcommand `ipython console` is deprecated and will be removed in future versions.
[TerminalIPythonApp] WARNING | You likely want to use `jupyter console` in the future
W, [2019-12-24T14:26:02.194322 #47933]  WARN -- : Could not load bundler: Could not locate Gemfile or .bundle/ directory
W, [2019-12-24T14:26:02.318205 #47933]  WARN -- : parent process poller thread started.
Jupyter console 6.0.0

IRuby 0.4.0 (with ffirzmq session adapter)

In [1]: c
NameError: undefined local variable or method `c' for main:Object
<main>:in `<main>'
/Users/sitalov/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/iruby-0.4.0/lib/iruby/backend.rb:44:in `eval'
/Users/sitalov/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/iruby-0.4.0/lib/iruby/backend.rb:44:in `eval'
/Users/sitalov/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/iruby-0.4.0/lib/iruby/backend.rb:12:in `eval'
/Users/sitalov/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:90:in `execute_request'
/Users/sitalov/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:49:in `dispatch'
/Users/sitalov/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:38:in `run'
/Users/sitalov/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/iruby-0.4.0/lib/iruby/command.rb:110:in `run_kernel'
/Users/sitalov/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/iruby-0.4.0/lib/iruby/command.rb:40:in `run'
/Users/sitalov/.rbenv/versions/2.6.4/lib/ruby/gems/2.6.0/gems/iruby-0.4.0/bin/iruby:5:in `<top (required)>'
/Users/sitalov/.rbenv/versions/2.6.4/bin/iruby:23:in `load'
/Users/sitalov/.rbenv/versions/2.6.4/bin/iruby:23:in `<main>'
Traceback (most recent call last):
  File "/usr/local/Caskroom/miniconda/base/bin/ipython", line 11, in <module>
    sys.exit(start_ipython())
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/site-packages/IPython/__init__.py", line 126, in start_ipython
    return launch_new_instance(argv=argv, **kwargs)
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/site-packages/traitlets/config/application.py", line 664, in launch_instance
    app.start()
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/site-packages/IPython/terminal/ipapp.py", line 352, in start
    return self.subapp.start()
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/site-packages/jupyter_console/app.py", line 156, in start
    self.shell.mainloop()
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 552, in mainloop
    self.interact()
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 544, in interact
    self.run_cell(code, store_history=True)
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 608, in run_cell
    self.handle_execute_reply(msg_id, timeout=0.05)
  File "/usr/local/Caskroom/miniconda/base/lib/python3.7/site-packages/jupyter_console/ptshell.py", line 646, in handle_execute_reply
    self.execution_count = int(content["execution_count"] + 1)
KeyError: 'execution_count'

If you suspect this is an IPython bug, please report it at:
    https://github.com/ipython/ipython/issues
or send an email to the mailing list at ipython-dev@python.org

You can print a more detailed traceback right now with "%tb", or use "%debug"
to interactively debug it.

Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
    c.Application.verbose_crash=True

 ✘  /Users/sitalov  W, [2019-12-24T14:26:03.321733 #47933]  WARN -- : parent process appears to exited, shutting down.

Some system information: (let me know what other things would be useful)

 ✘  /Users/sitalov  iruby --version
IRuby 0.4.0, Ruby 2.6.4
 /Users/sitalov  jupyter --version
jupyter core     : 4.6.1
jupyter-notebook : 6.0.1
qtconsole        : not installed
ipython          : 7.10.2
ipykernel        : 5.1.3
jupyter client   : 5.3.4
jupyter lab      : 1.1.4
nbconvert        : 5.6.1
ipywidgets       : 7.5.1
nbformat         : 4.4.0
traitlets        : 4.3.3
 /Users/sitalov  uname -a
Darwin a483e7ad3025.ant.amazon.com 18.7.0 Darwin Kernel Version 18.7.0: Sun Dec  1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64
kojix2 commented 4 years ago

Hello @Stvad Happy Holidays. Thank you for your reporting. If you don't mind, could you use github master?

Install specific_install

gem install specific_install

Install latest IRuby.

gem specific_install https://github.com/SciRuby/iruby
iruby register --force

Then

iruby

In [1]: c

Does the error still occur?

Stvad commented 4 years ago

Hey @kojix2, happy holidays to you as well!

Just followed your instructions and the version from master does not seem to encounter the problem :). Thank you!