SciRuby / iruby

Official gem repository: Ruby kernel for Jupyter/IPython Notebook
https://github.com/SciRuby/iruby
MIT License
890 stars 27 forks source link

Uninitialized constant IRuby::SessionAdapter::PyzmqAdapter::PyCall #257

Closed waiting-for-dev closed 4 years ago

waiting-for-dev commented 4 years ago

I'm trying to have a very minimal installation of jupyter + iruby, as my requirements are also very minimal.

I've followed the steps detailed in README file. I'm using docker so this is my current Dockerfile

FROM jupyter/base-notebook:latest
USER root
RUN apt-get update
RUN apt-get install -y libtool \
  libffi-dev \
  ruby \
  ruby-dev \
  make \
  libzmq3-dev \
  libczmq-dev
RUN gem install --no-ri --no-rdoc ffi-rzmq \
  pry \
  iruby
USER jovyan
RUN iruby register --force

When I open a notebook and select Ruby driver, I get following error in logs:

Unable to load this gem. The libzmq library (or DLL) could not be found.
If this is a Windows platform, make sure libzmq.dll is on the PATH.
If the DLL was built with mingw, make sure the other two dependent DLLs,
libgcc_s_sjlj-1.dll and libstdc++6.dll, are also on the PATH.
For non-Windows platforms, make sure libzmq is located in this search path:
["/var/lib/gems/2.5.0/gems/ffi-rzmq-core-1.0.7/lib/ffi-rzmq-core/../../ext/libzmq.so", "/opt/conda/bin/libzmq.so", "/opt/conda/bin/libzmq.so", "/usr/local/sbin/libzmq.so", "/usr/local/bin/libzmq.so", "/usr/sbin/libzmq.so", "/usr/bin/libzmq.so", "/sbin/libzmq.so", "/bin/libzmq.so", "/usr/lib/libzmq.so", "/usr/local/lib/libzmq.so", "/opt/local/lib/libzmq.so", "/usr/lib64/libzmq.so"]
/var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter/pyzmq_adapter.rb:7:in `rescue in load_requirements': uninitialized constant IRuby::SessionAdapter::PyzmqAdapter::PyCall (NameError)
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter/pyzmq_adapter.rb:4:in `load_requirements'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:7:in `available?'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:63:in `block in select_adapter_class'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:62:in `each_value'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session_adapter.rb:62:in `select_adapter_class'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session.rb:112:in `create_session_adapter'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/session.rb:12:in `initialize'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:17:in `new'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/kernel.rb:17:in `initialize'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/command.rb:110:in `new'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/command.rb:110:in `run_kernel'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/lib/iruby/command.rb:40:in `run'
    from /var/lib/gems/2.5.0/gems/iruby-0.4.0/bin/iruby:5:in `<top (required)>'
    from /usr/local/bin/iruby:23:in `load'
    from /usr/local/bin/iruby:23:in `<main>'

I've tried a tone of things, but I always get the same error:

When I use rubydata/datascience-notebook image, then it works. But it carries a lot of stuff I don't need, at it is also true for the minimal image in the same repo.

As I'm following the exact instructions detailed in the README for an Ubuntu 18 OS with just jupyter and its dependencies in it (which is what jupyter/base-notebook image provides), I think there is some error in these instructions. Am I wrong?

Thanks for any advice

P.S.: We're considering using jupyter + iruby as an interactive documentation tool for dry-rb ecosystem. This is the reason why my needs are so minimal.

kojix2 commented 4 years ago

Hi @waiting-for-dev

Thank you for trying out IRuby.

I just tried your Dockerfile to see if the issue is reproduced. But IRuby seemed to work on my local computer with docker. So I can’t reproduce the situation.

sudo docker build .
sudo docker run -i -t -p 8080:8888 e614a3bb5074

image

The error message you post seems to indicate that ffi-rzmq & ffi-rzmq-core running as the IRuby backend cannot find the shared library libzmq.so. PyzmqAdapter is called when the other adapter fails. It doesn't matter.

But To be honest, I ’m not familiar with Docker. So I might miss something. @mrkn may help you.

waiting-for-dev commented 4 years ago

Hi @kojix2 ,

thanks for your quick reply. It was surprising to see that it was working for you, so I decided to compile the Dockerfile with a different name for the image and (embarrassingly) it is working! I'm neither an expert in Docker, so I guess there is some issue with cache and that I didn't have it into account.

I guess I can close it, as surely it was due to some previous bad Dockerfile I compiled with the same name.

Thanks again and keep up the good work!