DEV Community

loading...

A short guide to setup a Jupyter notebook for Ruby (on a mac, with a fish shell)

Kostas
・1 min read

0. have Homebrew install

see https://brew.sh for instructions

0. have Ruby installed in some form

I suggest rbenv

1. download Anaconda from https://www.anaconda.com/downloads

2. install ☝️ (VS Code is optional, feel free to skip it)

3. set -g fish_user_paths /anaconda3/bin/ $fish_user_paths

4. test with jupyter notebook

  • it should open a browser window to the working directory
  • the next steps will add a "Ruby" option to the "New > Notebook" menu (up right)

5. install iRuby

instructions adapted from https://github.com/sciruby/iruby#homebrew

brew install automake gmp libtool wget
brew install zeromq --HEAD
brew install czmq --HEAD

set -x LIBZMQ_PATH (brew --prefix zeromq)/lib
set -x LIBCZMQ_PATH (brew --prefix czmq)/lib

gem install cztop
gem install iruby --pre
iruby register --force

6. restart your Jupyter notebook (Ctrl-C in the terminal it is running and then start it up again)

🎉

Discussion (8)

Collapse
perryraskin profile image
Perry Raskin

Hi, I'm using Bash. Followed instructions but I keep getting -bash: iruby: command not found. All other commands were successful. Any idea? Would really like to get to use Ruby on Jupyter Notebook!

Collapse
vrinek_94 profile image
Kostas Author

Hi Perry, how did step 5 play out? After gem install iruby, did you have a iruby executable in your PATH?

Collapse
perryraskin profile image
Perry Raskin

I'm not sure how to place it into my PATH. the set -x commands also did not work - -bash: syntax error near unexpected token('`

Thread Thread
vrinek_94 profile image
Kostas Author

Ah, yes. That’s fish-specific. For bash, export PATH /anaconda/bin $PATH. You will probably have to add this to your ~/.profile in order to persist between sessions.

Thread Thread
perryraskin profile image
Perry Raskin

If I'm on Mac and did not use anaconda, how should this command look?

Thread Thread
vrinek_94 profile image
Kostas Author • Edited

Oh, and the other set -x commands on step 5 have to be replaced with

export LIBZMQ_PATH $(brew --prefix zeromq)/lib
export LIBCZMQ_PATH $(brew --prefix czmq)/lib
Thread Thread
vrinek_94 profile image
Kostas Author

Oh, I’m not sure this’ll work without anaconda installed. I wrote these instructions while installing it on a Mac too.

Thread Thread
perryraskin profile image
Perry Raskin

got it, thanks