Jupyter Labs and Ruby
Wanted to setup Jupyter for Ruby to test out some ML stuff. Here's the setup I used and some issues I ran into.
Wanted to setup Jupyter for Ruby to test out some ML stuff. Here's the setup I used and some issues I ran into.
I use asdf for Ruby and also wanted to use Bundler to manage the ML gems.
Andrew Kane has a lot of helpful stuff for Ruby ML.
The Gemfile
source 'https://rubygems.org'
gem 'ffi-rzmq'
gem 'iruby', :git => 'https://github.com/sciruby/iruby.git', :branch => 'master'
Install
JupyterLab
brew install jupyterlab
# or
pip3 install jupyterlab
ZMQ
brew install automake gmp libtool wget
brew install zeromq --HEAD
brew install czmq --HEAD
ENV
export LIBZMQ_PATH=$(brew --prefix zeromq)/lib
export LIBCZMQ_PATH=$(brew --prefix czmq)/lib
Gemfile
bundle install
bundle exec iruby register --force
Run
bundled exec jupyter-lab
Jupyter
In the notebook, you can add the following to require everything in the Gemfile.
require 'rubygems'
require 'bundler/setup'
_ = Bundler.require(:default)
puts "setup"
Errors
Installing torch-rb
I got the following error. Looks like enable-shared should have been enabled, but it wasn't. I just installed the lastest Ruby with that flag.
Installing rice 2.2.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/dustycandland/.asdf/installs/ruby/2.6.2/lib/ruby/gems/2.6.0/gems/rice-2.2.0
/Users/dustycandland/.asdf/installs/ruby/2.6.2/bin/ruby -I /Users/dustycandland/.asdf/installs/ruby/2.6.2/lib/ruby/2.6.0 -r ./siteconf20200409-5600-a0rafr.rb extconf.rb
Unfortunately Rice does not build against a staticly linked Ruby.
You'll need to rebuild Ruby with --enable-shared to use this library.
If you're on rvm: rvm reinstall [version] -- --enable-shared
If you're on rbenv: CONFIGURE_OPTS="--enable-shared" rbenv install [version]
If you're on Heroku: upgrade your stack to heroku-16 or later
extconf failed, exit code 1
Reinstall Ruby with the --enable-shared
flag
RUBY_EXTRA_CONFIGURE_OPTIONS="--enable-shared" asdf install ruby 2.7.1
Webmentions
These are webmentions via the IndieWeb and webmention.io. Mention this post from your site: