标签: iruby

iRuby 内核不断被杀死

我是 macOS Sierra 10.12.3 上的 Ruby with Homebrew。我使用 pip install 安装了 jupyter,使用 gem install 安装了 iruby

当我运行时,iruby notebook服务器启动正常,但在创建新笔记本时,内核总是被以下日志杀死。

/usr/local/lib/ruby/gems/2.4.0/gems/iruby-0.2.9/lib/iruby/kernel.rb:18:in `initialize': uninitialized constant IRuby::Kernel::Session (NameError)
    from /usr/local/lib/ruby/gems/2.4.0/gems/iruby-0.2.9/lib/iruby/command.rb:70:in `new'
    from /usr/local/lib/ruby/gems/2.4.0/gems/iruby-0.2.9/lib/iruby/command.rb:70:in `run_kernel'
    from /usr/local/lib/ruby/gems/2.4.0/gems/iruby-0.2.9/lib/iruby/command.rb:34:in `run'
    from /usr/local/lib/ruby/gems/2.4.0/gems/iruby-0.2.9/bin/iruby:5:in `<top (required)>'
    from /usr/local/bin/iruby:22:in `load'
    from /usr/local/bin/iruby:22:in `<main>'
Run Code Online (Sandbox Code Playgroud)

我看过其他问题,但错误消息不同。

ruby jupyter iruby jupyter-notebook

5
推荐指数
1
解决办法
928
查看次数

Nyaplot 在 jupyterhub 中运行的 iruby 中不生成绘图

我正在尝试在现有的多用户 jupyterhub 安装中设置 Ruby 内核。它在我的所有测试中都有效,除了由 nyaplot (我能找到的唯一在 iruby 中工作的绘图包)创建的绘图不会显示在笔记本中。例如,以下代码(来自 Nyaplot 教程之一)没有给出错误(甚至在 syslog 文件中也没有),但没有绘图:

require 'nyaplot'
plot = Nyaplot::Plot.new
sc = plot.add(:scatter, [0,1,2,3,4], [-1,2,-3,4,-5])
color = Nyaplot::Colors.qual
sc.color(color)
plot.show # show plot on IRuby notebook
Run Code Online (Sandbox Code Playgroud)

背景:

以下是我如何设置 iruby 在 jupyterhub 中运行。我提供整个过程,以便 (a) 您可以发现是否缺少任何内容,以及 (b) 这样您就知道,如果您说“将 [this] 添加到 Gemfile”之类的内容,您将必须告诉我在哪里放置 Gemfile,因为 jupyterhub 没有在特定目录外运行 iruby。

操作系统是CentOS 7.3。由于其默认的 ruby​​ 版本太旧,无法运行 iruby,我使用 ruby​​-install 安装了一个版本的 ruby​​:

wget -O ruby-install-0.6.1.tar.gz https://github.com/postmodern/ruby-install/archive/v0.6.1.tar.gz
tar -xzvf ruby-install-0.6.1.tar.gz 
cd ruby-install-0.6.1
make
make install
ruby-install ruby 2.3.4
Run Code Online (Sandbox Code Playgroud)

(我使用了 ruby​​ 2.3,而不是 2.4,因为事实证明 sciruby-full 至少有一个组件还不能与 …

ruby graphics centos7 iruby jupyterhub

5
推荐指数
1
解决办法
322
查看次数

iruby 在 jupyter 笔记本中无法使用 bash 命令

我在我的 jupyter 笔记本中使用 iruby,内核按预期工作并接受所有类型的 ruby​​ 语法

不幸的是 %%bash 命令会导致错误。因此,在我的笔记本中没有可用的控制台命令。如果我切换回基本的 python 内核,%%bash 命令将按预期工作。

我怎样才能让 bash 命令在 iruby 内核中工作?是否有什么我忘记安装或设置的?

我在 Ubuntu 20.04 中使用以下设置:

我还使用 rvm 来管理我的 ruby​​ 版本。

基本设置

sudo apt install python3-pip python3-dev
sudo -H pip3 install --upgrade pip
sudo -H pip3 install virtualenv
pip install jupyter
Run Code Online (Sandbox Code Playgroud)

安装 iruby

gem install ffi-rzmq
gem install iruby --pre
iruby register --force
Run Code Online (Sandbox Code Playgroud)

设置并启动

rvm use ruby-2.7.2
mkdir ~/ruby_notebook

virtualenv ~/ruby_notebook/ruby_env
source ~/ruby_notebook/ruby_env/bin/activate

jupyter notebook --notebook-dir ~/ruby_notebook
Run Code Online (Sandbox Code Playgroud)

但出现以下错误: 在此输入图像描述

有什么想法可以解决这个问题以便我可以使用 bash 命令吗?

========更新和解决方案======

感谢 Engineersmnky 我找到了解决方案: …

ruby ruby-on-rails jupyter iruby jupyter-notebook

5
推荐指数
1
解决办法
273
查看次数