yohasebe / ruby-spacy

A wrapper module for using spaCy natural language processing library from the Ruby programming language via PyCall
MIT License
63 stars 5 forks source link

Error when launching rails console with ruby-spacy activated #7

Open ionosphere opened 9 months ago

ionosphere commented 9 months ago

Hi, I try to use this gem for entity recognition from a rails app.

ERROR

When launching the rails console or the server, an error occured.

rails c / rails s or foreman s pycall-1.5.1/lib/pycall/pyobject_wrapper.rb:77:in from_ruby': wrong argument type nil (expected PyCall::gcguard) (TypeError)

When we try to launch console wihtout this gem and only pycall gem, it works.

Notes that it works on an irb console, maybe another gem is in conflict.

TRACEBACK

11:24:57 web.1  | /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/binding_of_caller-1.0.0/lib/binding_of_caller/mri.rb:21: warning: constant RubyVM::DebugInspector is deprecated
11:24:57 web.1  | /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pycall-1.5.1/lib/pycall/pyobject_wrapper.rb:77:in `from_ruby': wrong argument type nil (expected PyCall::gcguard) (TypeError)
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pycall-1.5.1/lib/pycall/pyobject_wrapper.rb:77:in `!='
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/hpricot-0.8.6/lib/hpricot/blankslate.rb:59:in `method_added'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/elastic-apm-3.4.0/lib/elastic_apm/spies.rb:73:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.8.1/lib/active_support/dependencies.rb:291:in `block in require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.8.1/lib/active_support/dependencies.rb:257:in `load_dependency'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.8.1/lib/active_support/dependencies.rb:291:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pycall-1.5.1/lib/pycall/init.rb:39:in `init'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pycall-1.5.1/lib/pycall/init.rb:16:in `const_missing'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/pycall-1.5.1/lib/pycall.rb:82:in `import_module'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/numpy-0.4.0/lib/numpy.rb:4:in `<main>'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/elastic-apm-3.4.0/lib/elastic_apm/spies.rb:73:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/polyglot-0.3.5/lib/polyglot.rb:65:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.8.1/lib/active_support/dependencies.rb:291:in `block in require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.8.1/lib/active_support/dependencies.rb:257:in `load_dependency'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/activesupport-5.2.8.1/lib/active_support/dependencies.rb:291:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/ruby-spacy-0.2.2/lib/ruby-spacy.rb:5:in `<main>'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/elastic-apm-3.4.0/lib/elastic_apm/spies.rb:73:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/zeitwerk-2.4.2/lib/zeitwerk/kernel.rb:34:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.3.26/lib/bundler/runtime.rb:60:in `block (2 levels) in require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.3.26/lib/bundler/runtime.rb:55:in `each'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.3.26/lib/bundler/runtime.rb:55:in `block in require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.3.26/lib/bundler/runtime.rb:44:in `each'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.3.26/lib/bundler/runtime.rb:44:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bundler-2.3.26/lib/bundler.rb:186:in `require'
11:24:57 web.1  |   from /home/djoulin/projects/eky/config/application.rb:7:in `<main>'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-5.2.8.1/lib/rails/commands/server/server_command.rb:145:in `block in perform'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-5.2.8.1/lib/rails/commands/server/server_command.rb:142:in `tap'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-5.2.8.1/lib/rails/commands/server/server_command.rb:142:in `perform'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/thor-1.3.0/lib/thor/command.rb:28:in `run'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/thor-1.3.0/lib/thor/invocation.rb:127:in `invoke_command'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/thor-1.3.0/lib/thor.rb:527:in `dispatch'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-5.2.8.1/lib/rails/command/base.rb:69:in `perform'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-5.2.8.1/lib/rails/command.rb:46:in `invoke'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/railties-5.2.8.1/lib/rails/commands.rb:18:in `<main>'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11:24:57 web.1  |   from /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/bootsnap-1.18.3/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:30:in `require'
11:24:57 web.1  |   from bin/rails:4:in `<main>'
11:24:57 job.1  | /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/binding_of_caller-1.0.0/lib/binding_of_caller/mri.rb:21: warning: constant RubyVM::DebugInspector is deprecated
11:24:57 job.1  | /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/binding_of_caller-1.0.0/lib/binding_of_caller/mri.rb:21: warning: constant RubyVM::DebugInspector is deprecated
11:24:57 job.1  | /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/binding_of_caller-1.0.0/lib/binding_of_caller/mri.rb:21: warning: constant RubyVM::DebugInspector is deprecated
11:24:57 job.1  | /home/djoulin/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/gems/binding_of_caller-1.0.0/lib/binding_of_caller/mri.rb:21: warning: constant RubyVM::DebugInspector is deprecated
11:24:57 job.1  | wrong argument type nil (expected PyCall::gcguard)

ENV

ruby-spacy 0.2.2 pycall 1.5.1 Rails 5.2.8.1 Ruby 2.6.6 via Rbenv Python 3.10.6 via Pyenv Spacy 3.7.2 Ubuntu 20.04.5 LTS

yohasebe commented 3 months ago

I apologize for the extremely delayed response to your issue.

This problem seems to be related to the interaction between Rails and PyCall, which is beyond my area of expertise. I'm sorry, but I can't provide a specific solution for now. I would recommend reporting this issue on the PyCall GitHub repository. They might be able to provide more detailed support.

Thank you for your patience and for bringing this to our attention!