前提・実現したいこと
pycallも用いてrubyでpythonの機械学習も行いたいと考えています。
libディレクトリにcsvディレクトリを作成しその中にsample.csvというファイルを作成しました。
そこでrails sしてshowアクションを呼ぶと下記のエラーが出てしまい、railsサーバーがダウンしてしまいました。
解決法が見つからなかったのでもし、対処法があればご教示願いたいです。(エラーが2000行ほどの長文だったので該当箇所だけ下記に記載しました)
発生している問題・エラーメッセージ
/Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pycall-1.2.1/lib/pycall/pyobject_wrapper.rb:43: [BUG] Segmentation fault at 0x0000000000000008 ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18] -- Crash Report log information -------------------------------------------- See Crash Report log file under the one of following: * ~/Library/Logs/DiagnosticReports * /Library/Logs/DiagnosticReports for more details. Don't forget to include the above Crash Report log file in bug reports. -- Control frame information ----------------------------------------------- c:0072 p:---- s:0523 e:000522 CFUNC :read_csv c:0071 p:0102 s:0518 e:000517 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/pycall-1.2.1/lib/pycall/pyobject_wrapper.rb:43 c:0070 p:0059 s:0510 e:000509 METHOD /Users/takuma/projects/household/app/controllers/users_controller.rb:20 c:0069 p:0011 s:0503 e:000502 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/basic_implicit_render c:0068 p:0010 s:0497 e:000496 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/abstract_controller/base.rb:194 c:0067 p:0030 s:0491 e:000490 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/rendering.rb:30 c:0066 p:0010 s:0486 e:000485 BLOCK /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/abstract_controller/callbacks.rb:42 c:0065 p:0113 s:0483 E:000488 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/callbacks.rb:132 c:0064 p:0007 s:0473 E:000408 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/abstract_controller/callbacks.rb:41 c:0063 p:0009 s:0468 e:000467 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/rescue.rb:22 c:0062 p:0010 s:0462 e:000461 BLOCK /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:34 c:0061 p:0011 s:0457 e:000456 BLOCK /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:168 c:0060 p:0018 s:0454 e:000453 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications/instrumenter. c:0059 p:0027 s:0446 e:000445 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activesupport-5.2.3/lib/active_support/notifications.rb:168 c:0058 p:0104 s:0440 e:000439 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/instrumentation.rb:32 c:0057 p:0099 s:0434 e:000433 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal/params_wrapper.rb:256 c:0056 p:0024 s:0426 e:000425 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/activerecord-5.2.3/lib/active_record/railties/controller_runtime.r c:0055 p:0083 s:0420 e:000419 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/abstract_controller/base.rb:134 c:0054 p:0060 s:0413 e:000412 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionview-5.2.3/lib/action_view/rendering.rb:32 c:0053 p:0020 s:0407 e:000406 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal.rb:191 c:0052 p:0042 s:0400 e:000399 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_controller/metal.rb:252 c:0051 p:0011 s:0393 e:000392 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:52 c:0050 p:0041 s:0385 e:000384 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:34 c:0049 p:0135 s:0377 e:000376 BLOCK /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/journey/router.rb:52 [FINISH] c:0048 p:---- s:0365 e:000364 CFUNC :each c:0047 p:0010 s:0361 e:000360 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/journey/router.rb:35 c:0046 p:0041 s:0356 e:000355 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/actionpack-5.2.3/lib/action_dispatch/routing/route_set.rb:840 c:0045 p:0020 s:0350 e:000349 BLOCK /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/warden-1.2.8/lib/warden/manager.rb:36 [FINISH] c:0044 p:---- s:0347 e:000346 CFUNC :catch c:0027 p:0077 s:0211 e:000210 BLOCK /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:30 [FINISH] c:0026 p:---- s:0201 e:000200 CFUNC :catch c:0025 p:0007 s:0196 e:000195 METHOD /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/web-console-3.7.0/lib/web_console/middleware.rb:20 c:0003 p:0065 s:0026 e:000025 BLOCK /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/server.rb:334 c:0002 p:0127 s:0016 e:000015 BLOCK /Users/takuma/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/puma-3.12.1/lib/puma/thread_pool.rb:135 [FINISH] c:0001 p:---- s:0003 e:000002 (none) [FINISH]
[NOTE] You may have encountered a bug in the Ruby interpreter or extension libraries. Bug reports are welcome. For details: https://www.ruby-lang.org/bugreport.html [IMPORTANT] Don't forget to include the Crash Report log file under DiagnosticReports directory in bug reports.
users.controller.rb
ruby
1def show 2 # ユーザーの詳細情報 3 4 # ライブラリ読込 5 require 'pycall' 6 require 'pandas' 7 8 pd = Pandas 9 10 # ファイル読込 11 df = pd.read_csv(Rails.root + 'lib/csv/sample.csv', engine='python') 12 13end
補足情報(FW/ツールのバージョンなど)
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。