Giter VIP home page Giter VIP logo

iruby's Introduction

IRuby

Gem Version Build Status Binder

IRuby is a Ruby kernel for Jupyter project.

Try IRuby

You can try IRuby with a sample notebook on Binder (the same link as the banner placed above):

https://mybinder.org/v2/gh/RubyData/binder/master?filepath=ruby-data.ipynb

The following URL launches JupyterLab directly on Binder.

https://mybinder.org/v2/gh/RubyData/binder/master?filepath=../lab

Installation

Requirements

The following requirements are automatically installed.

The following dependencies are optional.

  • Pry, if you want to use Pry instead of IRB for the code execution backend

Installing Jupyter Notebook and/or JupyterLab

See the official document to know how to install Jupyter Notebook and/or JupyterLab.

Ubuntu

Ubuntu 17+

sudo apt install libtool libffi-dev ruby ruby-dev make

gem install --user-install iruby
iruby register --force

Ubuntu 16

The latest IRuby requires Ruby >= 2.4 while Ubuntu's official Ruby package is version 2.3. So you need to install Ruby >= 2.4 by yourself before preparing IRuby. We recommend to use rbenv.

sudo apt install libtool libffi-dev ruby ruby-dev make
gem install --user-install iruby
iruby register --force

Fedora

Fedora 36

sudo dnf install ruby ruby-dev make zeromq-devel

gem install --user-install iruby
iruby register --force

Windows

DevKit is necessary for building RubyGems with native C-based extensions.

gem install iruby
iruby register --force

macOS

Install ruby with rbenv or rvm. Install Jupyter.

Homebrew

gem install iruby
iruby register --force

MacPorts

If you are using macports, run the following commands.

port install libtool autoconf automake autogen
gem install iruby
iruby register --force

Docker

Try RubyData Docker Stacks. Running jupyter notebook:

docker run --rm -it -p 8888:8888 rubydata/datascience-notebook

Installation for JRuby

You can use Java classes in your IRuby notebook.

  • JRuby version >= 9.0.4.0
  • iruby gem

After installation, make sure that your env is set up to use jruby.

env ruby -v

If you use RVM, it is enough to switch the current version to jruby.

If you have already used IRuby with a different version, you need to generate a new kernel:

iruby register --force

Install the development version of IRuby

Be careful to use the development version because it is usually unstable.

If you want to install the development version of IRuby from the source code, try specific_install.

gem specific_install https://github.com/SciRuby/iruby

Note for using with CZTop and CZMQ

CZTop adapter has been deprecated since IRuby version 0.7.4. It will be removed after several versions.

If you want to use IRuby with CZTop, you need to install it and CZMQ.

If both ffi-rzmq and cztop are installed, ffi-rzmq is used. If you prefer cztop, set the following environment variable.

export IRUBY_SESSION_ADAPTER="cztop"

Backends

There are two backends: PlainBackend and PryBackend.

  • PlainBackend is the default backend. It uses IRB.
  • PryBackend uses Pry.

You can switch the backend to PryBackend by running the code below.

IRuby::Kernel.instance.switch_backend!(:pry)

Notebooks

Take a look at the example notebook and the collection of notebooks which includes a Dockerfile to create a containerized installation of iruby and other scientific gems. You can find the prebuild image at dockerhub.

Contributing

Contributions to IRuby are very welcome.

To former contributors

In February 2021, IRuby became the canonical repository and is no longer a fork from minrk/iruby. Please fork from this repository again before making pull requests.

License

Copyright (c) IRuby contributors and the Ruby Science Foundation.

Licensed under the MIT license.

iruby's People

Contributors

ankane avatar carreau avatar cgamesplay avatar domitry avatar ebababi avatar habemus-papadum avatar hainesr avatar homonecloco avatar jnv avatar kojix2 avatar kou avatar kozo2 avatar kylekyle avatar liudangyi avatar lokeshh avatar minad avatar minrk avatar mrkn avatar munshkr avatar murashin avatar olleolleolle avatar petergoldstein avatar rstammer avatar spacewander avatar thomasjm avatar tpei avatar v0dro avatar yuki-inoue avatar zalt50 avatar zheng-yongping avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

iruby's Issues

Unable to install on OS X El Capitan

Hi, I'm trying to install iRuby for the first time. I'm using OS X El Capitan. I've installed Jupyter/iPython and it's working fine. When I try to install iruby using gem install iruby, I get the following error

Building native extensions.  This could take a while...
ERROR:  Error installing iruby:
        ERROR: Failed to build gem native extension.

    /usr/local/var/rbenv/versions/2.2.2/bin/ruby -r ./siteconf20151109-82110-ok5sa9.rb extconf.rb
"./autogen.sh"
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal -I config --force -I config
autoreconf: configure.ac: tracing
autoreconf: configure.ac: subdirectory foreign/openpgm/build-staging/openpgm/pgm/ not present
autoreconf: configure.ac: not using Libtool
autoreconf: running: /usr/local/Cellar/autoconf/2.69/bin/autoconf --include=config --force
configure.ac:57: error: possibly undefined macro: AC_LIBTOOL_WIN32_DLL
      If this token and others are legitimate, please use m4_pattern_allow.
      See the Autoconf documentation.
configure.ac:58: error: possibly undefined macro: AC_PROG_LIBTOOL
configure:5346: error: possibly undefined macro: AC_DISABLE_STATIC
configure:5350: error: possibly undefined macro: AC_ENABLE_STATIC
autoreconf: /usr/local/Cellar/autoconf/2.69/bin/autoconf failed with exit status: 1
autogen.sh: error: autoreconf exited with status 0
ZeroMQ autogen failed!
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/var/rbenv/versions/2.2.2/bin/$(RUBY_BASE_NAME)
        --with-system-libs
        --without-system-libs

extconf failed, exit code 1

Gem files will remain installed in /usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/rbczmq-1.7.9 for inspection.
Results logged to /usr/local/var/rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-14/2.2.0-static/rbczmq-1.7.9/gem_make.out

Remove pry-syntax-hacks gem from Gemfile

After I did a bundle install from the Gemfile I get the following error message every time I start Pry/Iruby console:

require 'pry-syntax-hacks' # Failed, saying: undefined method `retrieve_line' for class `Pry'
$ pry --version
Pry version 0.10.1 on Ruby 2.2.0

Does it work for anybody else?

There is an 2 years old open issue for this at ConradIrwin/pry-syntax-hacks#2 but the gem is not maintained anymore for almost 3 years, falling behind the very active development of the main pry gem. Since it not working anymore, unmaintained and even has hacks in its name, I suggest we remove it from the Gemfile.

Does this have any negative effects on the pry backend for IRuby I overlooked?

Kernel dies occasionally

It works at times, but sometimes the kernel suddenly dies with this backtrace:


[2015-06-03T00:28:50.445538 #7036] FATAL -- : Kernel died: cannot load such file -- iruby
/home/sameer/.rvm/gems/ruby-2.2.1/gems/iruby-0.2.4/lib/iruby/command.rb:73:in `require'
/home/sameer/.rvm/gems/ruby-2.2.1/gems/iruby-0.2.4/lib/iruby/command.rb:73:in `run_kernel'
/home/sameer/.rvm/gems/ruby-2.2.1/gems/iruby-0.2.4/lib/iruby/command.rb:33:in `run'
/home/sameer/.rvm/gems/ruby-2.2.1/gems/iruby-0.2.4/bin/iruby:5:in `<top (required)>'
/home/sameer/.rvm/gems/ruby-2.2.1/bin/iruby:23:in `load'
/home/sameer/.rvm/gems/ruby-2.2.1/bin/iruby:23:in `<main>'
/home/sameer/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
/home/sameer/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'
/home/sameer/.rvm/gems/ruby-2.2.1/gems/iruby-0.2.4/lib/iruby/command.rb:73:in `require': cannot load such file -- iruby (LoadError)
    from /home/sameer/.rvm/gems/ruby-2.2.1/gems/iruby-0.2.4/lib/iruby/command.rb:73:in `run_kernel'
    from /home/sameer/.rvm/gems/ruby-2.2.1/gems/iruby-0.2.4/lib/iruby/command.rb:33:in `run'
    from /home/sameer/.rvm/gems/ruby-2.2.1/gems/iruby-0.2.4/bin/iruby:5:in `<top (required)>'
    from /home/sameer/.rvm/gems/ruby-2.2.1/bin/iruby:23:in `load'
    from /home/sameer/.rvm/gems/ruby-2.2.1/bin/iruby:23:in `<main>'
    from /home/sameer/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `eval'
    from /home/sameer/.rvm/gems/ruby-2.2.1/bin/ruby_executable_hooks:15:in `<main>'

Seems to blow up with malloc memory errors

WARNING:root:kernel 4f8155bd-ecff-4216-b34c-f4dd56bc4a8b restarted

Ignoring ffi-1.9.10 because its extensions are not built.  Try: gem pristine ffi --version 1.9.10

Ignoring bond-0.5.1 because its extensions are not built.  Try: gem pristine bond --version 0.5.1

ruby(5306,0x7fff7bf1b000) malloc: *** error for object 0x7f87a2cc8938: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

Trouble installing iruby in Windows

I could not install iRuby gem. The problem seems to be occurring during in the installation of the rbczmq 1.7 dependency.

Here is the gem make.out message logged on the C:\Ruby22-x64\lib\ruby\gems\2.2.0\extensions\x64-mingw32\2.2.0\rbczmq-1.7.9.

The message content follows:

C:/Ruby22-x64/bin/ruby.exe -r ./siteconf20150720-6208-162dmho.rb extconf.rb
checking for windows.h... yes
checking for winsock.h... yes
checking for main() in -lkernel32... yes
checking for main() in -lrpcrt4... yes
checking for main() in -lgdi32... yes
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=C:/Ruby22-x64/bin/$(RUBY_BASE_NAME)
--with-kernel32lib
--without-kernel32lib
--with-rpcrt4lib
--without-rpcrt4lib
--with-gdi32lib
--without-gdi32lib
extconf.rb:49:in `

': uninitialized constant GNU_CHAIN (NameError)

extconf failed, exit code 1

Kernel dead after entering ^C

Reproduce:
In a shell type: iruby ->
(I'm getting warnings at that point already:

/usr/local/lib/python2.7/dist-packages/IPython/kernel/manager.py:95: UserWarning: Setting kernel_cmd is deprecated, use kernel_spec to start different kernels.
  warnings.warn("Setting kernel_cmd is deprecated, use kernel_spec to "
/home/eyal/.rvm/gems/ruby-2.2.0/gems/iruby-0.1.13/lib/iruby/kernel.rb:175: warning: duplicated key at line 176 ignored: :type_class

) ->
After entering the iruby console, before entering any other command, click ^C ->
after doing so I receive the following error:

 Kernel died: 
/home/eyal/.rvm/gems/ruby-2.2.0/gems/ffi-rzmq-2.0.4/lib/ffi-rzmq/util.rb:38:in `zmq_errno'
/home/eyal/.rvm/gems/ruby-2.2.0/gems/ffi-rzmq-2.0.4/lib/ffi-rzmq/util.rb:38:in `errno'
/home/eyal/.rvm/gems/ruby-2.2.0/gems/ffi-rzmq-2.0.4/lib/ffi-rzmq/util.rb:93:in `raise_error'
/home/eyal/.rvm/gems/ruby-2.2.0/gems/ffi-rzmq-2.0.4/lib/ffi-rzmq/util.rb:73:in `error_check'
/home/eyal/.rvm/gems/ruby-2.2.0/gems/iruby-0.1.13/lib/iruby/session.rb:38:in `recv'
/home/eyal/.rvm/gems/ruby-2.2.0/gems/iruby-0.1.13/lib/iruby/kernel.rb:59:in `run'
/home/eyal/.rvm/gems/ruby-2.2.0/gems/iruby-0.1.13/lib/iruby/command.rb:30:in `run_kernel'
/home/eyal/.rvm/gems/ruby-2.2.0/gems/iruby-0.1.13/lib/iruby/command.rb:16:in `run'
/home/eyal/.rvm/gems/ruby-2.2.0/gems/iruby-0.1.13/bin/iruby:6:in `<top (required)>'
/home/eyal/.rvm/gems/ruby-2.2.0/bin/iruby:23:in `load'
/home/eyal/.rvm/gems/ruby-2.2.0/bin/iruby:23:in `<main>'
/home/eyal/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/home/eyal/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'

KeyboardInterrupt

Better logs

IRuby should use a ruby Logger to log rather than directly output to stderr.

My question is, is it necessary to use a multi-logger? The scenarios I can imagine are

  1. In development mode, developers need to inspect messages from or to ZMQ.
  2. In production mode, users may want to log to a file.

Question: can I use iruby with Ruby 2.0.0?

Hi,

This isn't an issue but rather a question. I see that for the current iteration, the min required version for ruby is 2.1.0.

I need to use ruby 2.0.0 because I'm using it to access one (and actually only one) API that works only on 2.0.0.

Can I use IRuby with ruby 2.0.0? How?

Thanks !

Ability for code to detect if running in iruby

Will it possible to define some sort of a constant or something similar that will let a ruby script query if it is running in the iruby browser environment?

This will allow optionally running code that will fancifully print stuff in iruby format (HTML) only when it is running in the iruby browser environment, and something else when running in the console (irb, pry,etc.).

To demonstrate:

if RUNNING_IN_IRUBY_BROWSER
  print "<h1>This is in iruby<h1>"
else
  print "This is in console"
end

How to register new version IRuby kernel?

I updated Ruby version, and manage ruby envrionment with rbenv.
Current iruby gem is installed under Ruby version 2.3.0-dev.
But jupyter kernels list does not update. I tried command iruby register --force. It does not register a new version ruby kernel. (I check out new kernel in jupyter notebook button New.)
Then I try to find out why. I checked out ~/.ipython/kernels/ruby/kernel.json. It is version 2.3.0.

{"argv":["/home/stardiviner/.gem/ruby/2.3.0/bin/iruby","kernel","{connection_file}"],
"display_name":"Ruby 2.3.0","language":"ruby"}

There is no other kenel configs under ~/.ipython/kernels/.
I don't know why jupyter notebook can't find new version ruby kernel.

Tab completion in a cell removes other lines

I updated to IRuby 0.2.0 recently and noticed a bug in which tab completion removes the preceding lines in the cell when I'm in the last line, or doesn't work at all when there are lines after the one I'm on. Take a look at these examples:

puts 123
puts 'asdf'
puts IRuby::VERSION.a<TAB>

In this case, I can choose a method when I press , but if I select one, the other lines are removed and the only one left is the last one (e.g. puts IRuby::VERSION.abs). If I press ESC and don't select a method, the cell is left as is.

puts 123
puts 'asdf'
puts IRuby::VERSION.a<TAB>
puts "fourth line"

In this case, when I press with the cursor in the third line, nothing happens.

Is there any other information you folks need? Or is this a known bug? I couldn't find anything about it in the issue tracker.

iruby and rbenv

I use Ruby 2.2.2 installed via rbenv on Ubuntu 15.04.
IRuby installed without problems, but when I tried to run iruby notebook it couldn't load any gems, giving error messages like:

LoadError: cannot load such file -- some_gem_i_have_installed
/usr/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
...

After spending an hour, trying to make it work, I ended up switching to system Ruby via rbenv shell system, and installing all my gems into system Ruby. After that everything worked fine.

Is there a way to make iruby work with rbenv Ruby without reinstalling all the gems into system Ruby?

how to pass kernel parameters?

Hi!
We've upgraded from ipython to jupyter and everthing seems to be working fine.

The only missing part, is that I'm not too sure how to pass this parameters to the kernel.

We used to do this using KernelManager.kernel_cmd but it's deprecated in Jupyter.

Specificaly, I'm wondering how to pass the boot_file path to iruby.

thanks!

trouble installing iruby on yosemite or el capitan OSX

I was able to install fine on ubuntu but would love to be able to install and use this on my main development mac.

Building native extensions. This could take a while... ERROR: Error installing iruby: ERROR: Failed to build gem native extension.

Cannot load on homebrew

Currently seeing this error when launching notebook using Python3

gems/iruby-0.2.5/lib/iruby/command.rb:73:in `require': cannot load such file -- iruby (LoadError)

FileLink

Hi, I've found this very interesting (FileLink)[http://nbviewer.jupyter.org/github/ipython/ipython/blob/1.x/examples/notebooks/Part%205%20-%20Rich%20Display%20System.ipynb#Links-to-local-files] function in Jupyter / Python for making local files downloadable via HTTP.

Is it possible to do something similar in iruby?

thanks!

PryBackend borks kernel

If pry detects an incomplete chunk of code, like this

def foo

it will wait until the input is complete to continue. I'm sure most IRuby users have bumped into this at some point and just reset the kernel. The problem is that there is no way to tell @pry.eval in backend.rb that there is no more input on its way.

There is a hint that things went south: If after running @pry.eval, there is still code in @pry.eval_string, then pry is waiting. Ideally, we should throw a syntax error and run @pry.reset_eval_string.

I would have submitted a PR, but I honestly wasn't sure if I should just reset the eval_string or if there were other things that needed to be cleaned up too. Either way, this shouldn't be terribly difficult to fix.

[OSX] malloc error incorrect checksum for freed object

I've got a case of this:

❯ jupyter qtconsole --kernel=ruby
W, [2015-12-16T18:04:53.245480 #44379]  WARN -- : Could not load bundler: Could not locate Gemfile or .bundle/ directory
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:198:in `rescue in root'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:194:in `root'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:101:in `bundle_path'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:435:in `configure_gem_home'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:427:in `configure_gem_home_and_path'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:92:in `configure'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:153:in `definition'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:109:in `check_bundler'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:67:in `run_kernel'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:34:in `run'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/bin/iruby:5:in `<top (required)>'
/usr/local/var/rbenv/versions/2.2.0/bin/iruby:23:in `load'
/usr/local/var/rbenv/versions/2.2.0/bin/iruby:23:in `<main>'
ruby(44379,0x7fff7882d300) malloc: *** error for object 0x7f8b2e2b2528: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
[JupyterQtConsoleApp] KernelRestarter: restarting kernel (1/5)
[JupyterQtConsoleApp] WARNING | kernel restarted
W, [2015-12-16T18:04:55.928800 #44385]  WARN -- : Could not load bundler: Could not locate Gemfile or .bundle/ directory
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:198:in `rescue in root'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:194:in `root'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:101:in `bundle_path'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:435:in `configure_gem_home'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:427:in `configure_gem_home_and_path'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:92:in `configure'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:153:in `definition'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:109:in `check_bundler'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:67:in `run_kernel'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:34:in `run'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/bin/iruby:5:in `<top (required)>'
/usr/local/var/rbenv/versions/2.2.0/bin/iruby:23:in `load'
/usr/local/var/rbenv/versions/2.2.0/bin/iruby:23:in `<main>'
ruby(44385,0x7fff7882d300) malloc: *** error for object 0x7f8085d3c398: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug

The error keeps respawning unless I Ctrl-C or close the qtconsole. And the similar:

❯ jupyter console --kernel=ruby
W, [2015-12-16T18:10:25.110421 #44674]  WARN -- : Could not load bundler: Could not locate Gemfile or .bundle/ directory
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:198:in `rescue in root'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:194:in `root'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:101:in `bundle_path'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:435:in `configure_gem_home'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:427:in `configure_gem_home_and_path'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:92:in `configure'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/bundler-1.9.2/lib/bundler.rb:153:in `definition'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:109:in `check_bundler'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:67:in `run_kernel'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/lib/iruby/command.rb:34:in `run'
/usr/local/var/rbenv/versions/2.2.0/lib/ruby/gems/2.2.0/gems/iruby-0.2.8/bin/iruby:5:in `<top (required)>'
/usr/local/var/rbenv/versions/2.2.0/bin/iruby:23:in `load'
/usr/local/var/rbenv/versions/2.2.0/bin/iruby:23:in `<main>'
ruby(44674,0x7fff7882d300) malloc: *** error for object 0x7f904305a508: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Jupyter Console 4.0.3

[ZMQTerminalIPythonApp] Loading IPython extension: storemagic

Which hangs until I force TERM the process.
Ruby version is:

ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin13]

I'm on OSX Yosemite 10.10.5, I installed jupyter in a pyenv something like

pyenv virtualenv 3.5 jupyter
pyenv activate jupyter
pip install jupyter

My kernels are:

  ruby       /Users/<user>/.ipython/kernels/ruby
  python3    /usr/local/var/pyenv/versions/jupyter/lib/python3.5/site-packages/ipykernel/resources
  ir         /usr/local/share/jupyter/kernels/ir

and they seem to work except the ruby one.

readlink() function is unimplemented on this machine (NotImplementedError) - Windows 7 x64

I followed the Windows installation instructions on the master branch README and gem install iruby -v 0.1.13 for Python27. However, I got the following:

$ iruby notebook
[ProfileCreate] Generating default config file: u'C:\Users\Matt.config\iruby\profile_d efault\ipython_config.py'
[ProfileCreate] Generating default config file: u'C:\Users\Matt.config\iruby\profile_d efault\ipython_kernel_config.py'
[ProfileCreate] Generating default config file: u'C:\Users\Matt.config\iruby\profile_d efault\ipython_console_config.py'
[ProfileCreate] Generating default config file: u'C:\Users\Matt.config\iruby\profile_d efault\ipython_qtconsole_config.py'
[ProfileCreate] Generating default config file: u'C:\Users\Matt.config\iruby\profile_d efault\ipython_notebook_config.py'
[ProfileCreate] Generating default config file: u'C:\Users\Matt.config\iruby\profile_d efault\ipython_nbconvert_config.py'
C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/iruby-0.1.13/lib/iruby/command.rb:89:in readlink': readlink() function is unimplemented on this machine (NotImplementedError) from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/iruby-0.1.13/lib/iruby/command.rb:89:increate_profile'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/iruby-0.1.13/lib/iruby/command.rb:62:in run_ipython' from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/iruby-0.1.13/lib/iruby/command.rb:18:inrun'
from C:/Ruby200-x64/lib/ruby/gems/2.0.0/gems/iruby-0.1.13/bin/iruby:6:in <top (requ ired)>' from C:/Ruby200-x64/bin/iruby:23:inload'
from C:/Ruby200-x64/bin/iruby:23:in `

'
Creating profile directory C:/Users/Matt/.config/iruby/profile_default

Could not load bundler: Could not locate Gemfile or .bundle/ directory

I tried installing iruby using RVM into my global gemset. Now, I'm getting the following error:

$ iruby
Could not load bundler: Could not locate Gemfile or .bundle/ directory
W, [2015-08-06T05:22:30.899010 #26154]  WARN -- : Could not load bundler: Could not locate Gemfile or .bundle/ directory
/Users/yosriady/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.8.4/lib/bundler.rb:198:in `rescue in root'
/Users/yosriady/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.8.4/lib/bundler.rb:194:in `root'
/Users/yosriady/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.8.4/lib/bundler.rb:101:in `bundle_path'
/Users/yosriady/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.8.4/lib/bundler.rb:420:in `configure_gem_home_and_path'
/Users/yosriady/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.8.4/lib/bundler.rb:92:in `configure'
/Users/yosriady/.rvm/gems/ruby-2.2.0@global/gems/bundler-1.8.4/lib/bundler.rb:153:in `definition'
/Users/yosriady/.rvm/gems/ruby-2.2.0@global/gems/iruby-0.2.7/lib/iruby/command.rb:109:in `check_bundler'
/Users/yosriady/.rvm/gems/ruby-2.2.0@global/gems/iruby-0.2.7/lib/iruby/command.rb:67:in `run_kernel'
/Users/yosriady/.rvm/gems/ruby-2.2.0@global/gems/iruby-0.2.7/lib/iruby/command.rb:34:in `run'
/Users/yosriady/.rvm/gems/ruby-2.2.0@global/gems/iruby-0.2.7/bin/iruby:5:in `<top (required)>'
/Users/yosriady/.rvm/rubies/ruby-2.2.0/bin/iruby:23:in `load'
/Users/yosriady/.rvm/rubies/ruby-2.2.0/bin/iruby:23:in `<main>'
/Users/yosriady/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `eval'
/Users/yosriady/.rvm/gems/ruby-2.2.0/bin/ruby_executable_hooks:15:in `<main>'

Any ideas? I also tried requiring gnuplot in my Ruby notebooks, and it fails.

LoadError: cannot load such file -- gnuplot

`puts` does not work correctly with multiple arguments

I found puts doesn't work with multiple arguments.

with pry

~ ❯❯❯ ruby --version
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-darwin14]
~ ❯❯❯ pry
[1] pry(main)> puts "A", "B"
A
B
=> nil

with iruby

~ ❯❯❯ iruby --version
2.1.0

~ ❯❯❯ iruby
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/iruby-0.1.13/lib/iruby/kernel.rb:175: warning: duplicated key at line 176 ignored: :type_class

In [1]: puts "A", "B"
ArgumentError: wrong number of arguments (2 for 1)
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/iruby-0.1.13/lib/iruby/ostream.rb:36:in `puts'
(pry):1:in `puts'
(pry):1:in `<main>'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:355:in `eval'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:355:in `evaluate_ruby'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:323:in `handle_line'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:243:in `block (2 levels) in eval'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:242:in `catch'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:242:in `block in eval'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:241:in `catch'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:241:in `eval'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/iruby-0.1.13/lib/iruby/backend.rb:28:in `eval'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/iruby-0.1.13/lib/iruby/kernel.rb:110:in `execute_request'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/iruby-0.1.13/lib/iruby/kernel.rb:62:in `run'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/iruby-0.1.13/lib/iruby/command.rb:30:in `run_kernel'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/iruby-0.1.13/lib/iruby/command.rb:16:in `run'
/Users/mic/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/iruby-0.1.13/bin/iruby:6:in `<top (required)>'
/Users/mic/.rbenv/versions/2.2.2/bin/iruby:23:in `load'
/Users/mic/.rbenv/versions/2.2.2/bin/iruby:23:in `<main>'

Possible solution to requiring a Gemfile in the iruby PWD.

A possible solution to having a Gemfile in the directory where the iruby command is run would be create a temporary file called Gemfile and add all the gems yielded by gem list to that file, in the format required by Gemfiles.

Once the notebook is terminated, we can delete the Gemfile as a cleanup operation.

This can be done only if a Gemfile is not present in the directory, in which case the default Gemfile will be used.

add a 'Welcome to Ruby' notebook to try.jupyter.org?

Hi! I know this would be better on the actual jupyter repo but wanted to ping you here since this is more active for Rubyists. try.jupyter.org already has a Ruby kernel built in so all that the repo needs is a ruby notebook with a quick few cells of welcome content.

here's their repo: https://github.com/jupyter/docker-demo-images

I could do it but am a ruby novice. Better someone who can showcase why it would be nice to have ruby on a notebook, right?

Migrate to IPython 3

  1. The next iruby gem version starting from iruby 0.2 will drop support for IPython versions < 3
  2. The iruby 0.1 series will still continue IPython 2, but only urgent bug fixes will be backported

This change is necessary since IPython3 introduces protocol changes and is optimized for other language kernels. With IPython4, the language agnostic part will go to the project http://jupyter.org/

See original issues:

Timeout at startup

Timeout waiting for kernel_info reply from ...

Somethings wrong with 0mq at startup.

Download as Ruby fails

Try this at at try.jupyter.org:

  1. Open Ruby notebook.
  2. Put in one line, e.g.
    puts "hello"
  3. Use menu File > Download as > Ruby (rb). Result is error:
    500 : Internal Server Error
    The error was:
    nbconvert failed: FileExtension trait 'file_extension' does not begin with a dot: 'rb'

Note that unlike other Download formats in the pulldown menu, "Ruby (rb)" does not have a dot before the extension in parens.

Workaround is to download as Python and rename the .py file to .rb. Bug reproduced using rvm with Ruby 2.2 and iruby gem on OS X 10.10.3 laptop.

Make this a proper fork.

It would be good for folks to know that this is the "official" version by fully breaking it off from the originating repos, either by getting it transferred or by creating it as a wholly new repo. There might be a way to put a ticket in to GitHub to make this a source rather than a fork too. Not sure though.

Allow repl launched from code to be handled from within notebook?

The use case is the following: I have a long data massaging loop like

entries.each do 
  begin
    ... a lot of stuff that can go wrong
  rescue => e
   binding.pry
  end

if an error occur, I end up inside a pry session and I can properly inspect the data, error and eventually re-run the computation.

If I do this from within a notebook though the new pry session is launched in the underlying terminal, somewhat conflicting with the notebook logs.

It would be awesome to have the ability to launch a sub-repl from the notebook and interact with it.
Would this be possible, or it maybe already is, or does what I'm saying not even make sense?

Anyway, thanks for your work on iRuby, it's awesome.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.