Movatterモバイル変換


[0]ホーム

URL:


LoginSignup
3

Go to list of users who liked

0

Share on X(Twitter)

Share on Facebook

Add to Hatena Bookmark

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

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$cdsomeProject

Pythonパッケージインストール

$ pipenv install jupyter

Rubyパッケージインストール

$ bundle init
Gemfile
# 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/bundle

Jupyter NotebookにRuby kernelを登録

次のコマンドが唯一のポイントです。

$ pipenv run bundle exec iruby resister

pipenv 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 notebook

New▼からRubyが選べる!しあわせ!

3

Go to list of users who liked

0
0

Go to list of comments

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3

Go to list of users who liked

0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?


[8]ページ先頭

©2009-2025 Movatter.jp