lambdalisue / jupyter-vim-binding

Jupyter meets Vim. Vimmer will fall in love.
2.1k stars 136 forks source link

Vim-binding does not react #111

Closed pococito closed 7 years ago

pococito commented 7 years ago

Summary

Hi, as a fellow vimmer - thanks for the extension, however - I cannot make it work and need help with debugging why.

Environment

Behavior

Trying to get any vim extension functionality reaction: yy, p, F1

Expected

copy, paste, help...

Actual

no vim-like reaction

Step by step procedure

  1. Start local Jupyter Notebook by jupyter notebook
  2. Access http://localhost:8888/
  3. Open any .ipynb notebook and try vim binding keys

What you have done to solve the issue

Remarks

Despite supposedly proper installation it does not work nor shows any error messages. I get a couple log messages though from 'jupyter notebook' stdout, probably unrelated:

[W 16:24:59.918 NotebookApp] server_extensions is deprecated, use nbserver_extensions
(..)
[29976:30003:0816/162500.742108:ERROR:nss_util.cc(808)] After loading Root Certs, loaded==false: NSS error code: -8018
(..)
[W 16:25:27.573 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20170816162459 (::1) 15.19ms referer=http://localhost:8888/notebooks/rnn-jupyter/testing123.ipynb

How do I debug this?

lambdalisue commented 7 years ago

Hum... Let me know the output of the javascript console in browser's develop tool.

pococito commented 7 years ago
Navigated to http://localhost:8888/notebooks/rnn-jupyter/testing123.ipynb
menubar.js:303 actions jupyter-notebook:find-and-replace does not exist, still binding it in case it will be defined later...
MenuBar.bind_events @ menubar.js:303
MenuBar @ menubar.js:58
(anonymous) @ main.js:138
execCb @ require.js?v=6da8be3…:1690
check @ require.js?v=6da8be3…:865
(anonymous) @ require.js?v=6da8be3…:1140
(anonymous) @ require.js?v=6da8be3…:131
(anonymous) @ require.js?v=6da8be3…:1190
each @ require.js?v=6da8be3…:56
emit @ require.js?v=6da8be3…:1189
check @ require.js?v=6da8be3…:940
enable @ require.js?v=6da8be3…:1177
init @ require.js?v=6da8be3…:783
callGetModule @ require.js?v=6da8be3…:1204
completeLoad @ require.js?v=6da8be3…:1583
onScriptLoad @ require.js?v=6da8be3…:1711
utils.js:60 load_extensions ["nbextensions_configurator/config_menu/main", "contrib_nbextensions_help_item/main", "vim_binding/vim_binding", callee: (...), Symbol(Symbol.iterator): function]0: "nbextensions_configurator/config_menu/main"1: "contrib_nbextensions_help_item/main"2: "vim_binding/vim_binding"callee: (...)length: 3Symbol(Symbol.iterator): function values()get callee: function ThrowTypeError()set callee: function ThrowTypeError()__proto__: Object
session.js:54 Session: kernel_created (adee528d-d801-4c2f-9d6b-246cf4d03184)
kernel.js:459 Starting WebSockets: ws://localhost:8888/api/kernels/fdf39ada-bbee-45d4-93e9-e9f0bdf0629e
utils.js:37 Loading extension: nbextensions_configurator/config_menu/main
utils.js:37 Loading extension: contrib_nbextensions_help_item/main
kernel.js:103 Kernel: kernel_connected (fdf39ada-bbee-45d4-93e9-e9f0bdf0629e)
kernel.js:103 Kernel: kernel_ready (fdf39ada-bbee-45d4-93e9-e9f0bdf0629e)
shortcuts.js?v=20170817102144:175 Uncaught SyntaxError: Unexpected token )
utils.js:37 Loading extension: vim_binding/vim_binding
require.js?v=6da8be3…:1952 GET http://localhost:8888/nbextensions/widgets/notebook/js/extension.js?v=20170817102144 
req.load @ require.js?v=6da8be3…:1952
load @ require.js?v=6da8be3…:1679
load @ require.js?v=6da8be3…:829
fetch @ require.js?v=6da8be3…:819
check @ require.js?v=6da8be3…:851
enable @ require.js?v=6da8be3…:1177
enable @ require.js?v=6da8be3…:1550
(anonymous) @ require.js?v=6da8be3…:1162
(anonymous) @ require.js?v=6da8be3…:131
each @ require.js?v=6da8be3…:56
enable @ require.js?v=6da8be3…:1114
init @ require.js?v=6da8be3…:783
(anonymous) @ require.js?v=6da8be3…:1453
main.js:223 Widgets are not available.  Please install widgetsnbextension or ipywidgets 4.0
(anonymous) @ main.js:223
vim_binding.js?v=20170817102144:63 Uncaught (in promise) TypeError: Cannot read property 'attach' of undefined
    at Object.attach (vim_binding.js?v=20170817102144:63)
    at vim_binding.js?v=20170817102144:58
attach @ vim_binding.js?v=20170817102144:63
(anonymous) @ vim_binding.js?v=20170817102144:58
notebook.js?v=20170817102144:19 Uncaught TypeError: Cannot read property 'insertMode' of undefined
    at onBlurWindow (notebook.js?v=20170817102144:19)
onBlurWindow @ notebook.js?v=20170817102144:19
jquery.typeahead.js:1925 --- jQuery Typeahead Debug ---
jquery.typeahead.js:1926 (index)nodefunctionargumentsmessageOK - Typeahead activated on """init()""""OK - Typeahead activated on "Object
notebook.js?v=20170817102144:19 Uncaught TypeError: Cannot read property 'insertMode' of undefined
    at onBlurWindow (notebook.js?v=20170817102144:19)
onBlurWindow @ notebook.js?v=20170817102144:19
lambdalisue commented 7 years ago
main.js:223 Widgets are not available.  Please install widgetsnbextension or ipywidgets 4.0
(anonymous) @ main.js:223

It seems your jupyter installation has failed. Reinstall it in a fresh environment. I confirmed with the following

# Create a new fresh virtualenv
python3 -m venv .venv3
# Activate the env
source activate .venv3
# Install jupyter
pip install jupyter
# Create required directory in case (optional)
mkdir -p $(jupyter --data-dir)/nbextensions
# Clone the repository
cd $(jupyter --data-dir)/nbextensions
git clone https://github.com/lambdalisue/jupyter-vim-binding vim_binding
# Activate the extension
jupyter nbextension enable vim_binding/vim_binding
pococito commented 7 years ago

I did a fresh venv, reinstalled jupyter, cloned your repo and it still does not work. Both ipywidgets and widgetnbextension are (and were) installed.

(dupa) pawel@paweldebian:testpy$ pip list | egrep 'widg|jupy'
ipywidgets (7.0.0)
jupyter (1.0.0)
jupyter-client (5.1.0)
jupyter-console (5.2.0)
jupyter-core (4.3.0)
widgetsnbextension (3.0.0)

JS console:

menubar.js:303 actions jupyter-notebook:find-and-replace does not exist, still binding it in case it will be defined later...
MenuBar.bind_events @ menubar.js:303
utils.js:60 load_extensions Arguments(3)
main.js Failed to load resource: the server responded with a status of 404 (Not Found)
utils.js:62 Failed to load extension: Array(1) Error: Script error for "nbextensions/nbextensions_configurator/config_menu/main"
http://requirejs.org/docs/errors.html#scripterror
    at makeError (require.js?v=6da8be3…:165)
    at HTMLScriptElement.onScriptError (require.js?v=6da8be3…:1732)
(anonymous) @ utils.js:62
utils.js:37 Loading extension: contrib_nbextensions_help_item/main
events.js:33 Exception in event handler for spec_changed.Kernel SessionAlreadyStarting Arguments(2)
events.trigger @ events.js:33
session.js:54 Session: kernel_created (78b8910d-2f66-4300-8eff-f874b7ec7b5e)
kernel.js:459 Starting WebSockets: ws://localhost:8888/api/kernels/72b8c9c3-b36c-4c94-8499-2fef50cd97cd
extension.js Failed to load resource: the server responded with a status of 404 (Not Found)
main.min.js:36594 Widgets are not available.  Please install widgetsnbextension or ipywidgets 4.0
(anonymous) @ main.min.js:36594
:8888/nbextensions/vim_binding/lib/jupyter/shortcuts.js?v=20170821222916:175 Uncaught SyntaxError: Unexpected token )
main.min.js:12406 Loading extension: vim_binding/vim_binding
:8888/nbextensions/vim_binding/vim_binding.js?v=20170821222916:63 Uncaught (in promise) TypeError: Cannot read property 'attach' of undefined
    at Object.attach (:8888/nbextensions/vim_binding/vim_binding.js?v=20170821222916:63)
    at :8888/nbextensions/vim_binding/vim_binding.js?v=20170821222916:58
attach @ :8888/nbextensions/vim_binding/vim_binding.js?v=20170821222916:63
(anonymous) @ :8888/nbextensions/vim_binding/vim_binding.js?v=20170821222916:58
kernel.js:103 Kernel: kernel_connected (72b8c9c3-b36c-4c94-8499-2fef50cd97cd)
kernel.js:103 Kernel: kernel_ready (72b8c9c3-b36c-4c94-8499-2fef50cd97cd)
notebook.js?v=20170821222916:19 Uncaught TypeError: Cannot read property 'insertMode' of undefined
    at onBlurWindow (notebook.js?v=20170821222916:19)
lambdalisue commented 7 years ago

Hum... but it works well on my environment.....

In case, I re-opened it.

pococito commented 7 years ago

I just upgraded my linux distro and circumstantially it started working..

lambdalisue commented 7 years ago

Ok. Good to hear :-)

uduse commented 6 years ago

I had a similar problem (Widgets are not available), but solved it using:

pip install ipywidgets
jupyter nbextension enable --py widgetsnbextension