3
Go to list of users who liked
0
Share on X(Twitter)
Share on Facebook
More than 5 years have passed since last update.
Pipenv管理下のJupyter NotebookプロジェクトにRuby kernelをBundlerで入れる
Posted at
グローバルな環境にPython, Pipenv, Ruby, Bundlerはインストール済みと仮定します。
動作確認済みのバージョンは以下
$python--versionPython 3.6.2$pipenv--versionpipenv, version 2018.05.18$ruby-vruby 2.5.1p57 (2018-03-29 revision 63029) [x86_64-darwin16]$bundle-vBundler version 1.16.2プロジェクト開始
$mkdirsomeProject$cdsomeProjectPythonパッケージインストール
$ pipenv install jupyterRubyパッケージインストール
$ bundle initGemfile
# frozen_string_literal: truesource"https://rubygems.org"git_source(:github){|repo_name|"https://github.com/#{repo_name}"}gem'cztop'gem'iruby'gem'rbczmq'$ bundle install --path=vendor/bundleJupyter NotebookにRuby kernelを登録
次のコマンドが唯一のポイントです。
$ pipenv run bundle exec iruby resisterpipenv runしないとipythonコマンドが見つからないと怒られます。
間違ったコマンド
$bundleexeciruby resisterbundler: failed to load command: iruby (path/to/someProject/vendor/bundle/ruby/2.5.0/bin/iruby)Errno::ENOENT: No such file or directory - ipython設定ファイル変更
前述のコマンドで~/.ipythonディレクトリが作られますので、以下のようにファイルを変更します。
(display_nameはお好みで変更可)
~/.ipython/kernels/ruby/kernel.json
{"argv":["pipenv","run","bundle","exec","iruby","kernel","{connection_file}"],"display_name":"Ruby 2.5.1","language":"ruby"}実行
$ pipenv run jupyter notebookNew▼からRubyが選べる!しあわせ!
Register as a new user and use Qiita more conveniently
- You get articles that match your needs
- You can efficiently read back useful information
- You can use dark theme