DEV Community

Discussion on: Ruby kernel in Google Colaboratory.

Collapse
 
kojix2 profile image
kojix2

Hello. PhillipMaire
You are right. Now the method of installing IRuby needs to be changed.

  1. Upload IRuby notebook.
  2. Start IRuby notebook whith python (Ruby doesn't work, only python works.). Run the following commands.
!apt-get install ruby-dev
!sudo apt install libtool libffi-dev ruby ruby-dev make
!sudo apt install libzmq3-dev libczmq-dev
!gem install ffi-rzmq
!gem install specific_install
!gem specific_install https://github.com/SciRuby/iruby
!iruby register
Enter fullscreen mode Exit fullscreen mode
  1. Then, while keeping the notebook open, change the runtime to Ruby. I think this method will work.

If you can't start Ruby, you can use the following command to check if the kernel is installed.

!jupyter kernelspec list
Enter fullscreen mode Exit fullscreen mode

Regards.

Collapse
 
phillipmaire profile image
PhillipMaire • Edited

Hey so this worked great! I got the kernelspec list to list out ruby. I dont know how to initiate the ruby session though. you said to change the runtime to ruby but when I go to runtime dropdown box runtime seems to just be related to the processing unit type (GPU CPU TPU). How would I switch to ruby? also I am using a mac and I noticed when I run "!jupyter kernelspec list" I get

Available kernels:
ruby /root/.local/share/jupyter/kernels/ruby
ir /usr/local/share/jupyter/kernels/ir
python2 /usr/local/share/jupyter/kernels/python2
python3 /usr/local/share/jupyter/kernels/python3
swift /usr/local/share/jupyter/kernels/swift

as pictured. The ruby directory has a period before local, which I know for mac is indicating a hidden folder. I am wondering if there is an issue here?

thank you for your work on this!

dev-to-uploads.s3.amazonaws.com/i/...

Thread Thread
 
kojix2 profile image
kojix2 • Edited

It looks like you installed the ruby kernel correctly. In addition to the hardware accelerator, I think you'll see a comobobox to select a language.
(I tried to change the language of GoogleColab's settings to English to take the screenshot, but was unable to do so for some reason. Instead I found cat mode and corgi mode.)

Ruby's kernel isn't officially supported by Google, so the installation location is different, and that's okay I guess!

img

Click the save button to start a Ruby session.

Thread Thread
 
phillipmaire profile image
PhillipMaire

Oh I see. I dont have that option “Runtime type”. I looked into it and it seems I need a notebook which has this already, I think??? This link to stack overflow gives a link to a java notebook which activate that dropdown box for me. But it only has jar and python (even after I install ruby in that notebook).

stackoverflow.com/questions/623036...

here is an example of it working with that java notebook from the link
dev-to-uploads.s3.amazonaws.com/i/...

here is what mine looks like when I open a new notebook and install ruby
dev-to-uploads.s3.amazonaws.com/i/...

I think this has something to do with your tutorial where you upload the ruby notebook??? I saved it and uploaded it but I must not be doing it right because it just looks like this and doesnt affect anything

dev-to-uploads.s3.amazonaws.com/i/...
dev-to-uploads.s3.amazonaws.com/i/...
dev-to-uploads.s3.amazonaws.com/i/...

Thread Thread
 
kojix2 profile image
kojix2 • Edited

I see. That's odd....
You will need to upload a new notebook.
My article is out of date, so please use the latest version of the Notebook made by Goto, who wrote an article on how to use Ruby on Google colab yesterday. It might work fine.

gist.githubusercontent.com/ngoto/6...
(Don't worry about the Japanese comments in the notes.)

You may also find the article made by Goto helpful. (This is a Japanese article from a Dev.to-like site called Qiita, which you can read using Google Translate.)
qiita.com/ngotogenome/items/d95a7a...

Thread Thread
 
phillipmaire profile image
PhillipMaire

yesssssssssss!!!!! that worked! thank you so much for your guidance!!! I made a google colab file with english comments and sections for other people to use if they want to. credited the original author and also you since you helped me make it work! thanks again!!!!

colab.research.google.com/drive/1n...