jupyter-vim-binding icon indicating copy to clipboard operation
jupyter-vim-binding copied to clipboard

Failing to enable vim_binding; validation issues

Open egorananyev opened this issue 9 years ago • 13 comments

Summary

Enabling vim_binding at the end of install does not activate them, but throws a validation problem (see below) on Windows 10, Anaconda, Python 2.

Environment

  • [ ] Operating system : Windows 10 x64
  • [ ] Web browser : Firefox 49.0.1
  • [ ] Version or revision of Jupyter Notebook : jupyter (1.0.0) jupyter-client (4.3.0) jupyter-console (4.1.1) jupyter-core (4.1.0) notebook (4.2.1)
  • [ ] Revision of jupyter-vim-binding : 94769bd

Behavior

When running command: jupyter nbextension enable vim_binding/vim_binding

Expected

Enabling vim_bindings.

Actual

Output:

Unrecognized JSON config file version, assuming version 1 Enabling notebook extension vim_binding/vim_binding... - Validating: problems found: - require? X vim_binding/vim_binding

The vim bindings do not work with Jupyter Notebook after this.

Step by step procedure

(Followed the installation instructions): $ mkdir -p $(jupyter --data-dir)/nbextensions $ cd $(jupyter --data-dir)/nbextensions $ git clone https://github.com/lambdalisue/jupyter-vim-binding vim_binding $ jupyter nbextension enable vim_binding/vim_binding

What you have done to solve the issue

Tried reinstalling, which did not solve the issue.

egorananyev avatar Oct 09 '16 09:10 egorananyev

Unrecognized JSON config file version, assuming version 1

Hum... https://github.com/ipython-contrib/jupyter_contrib_nbextensions/issues/727 may helps you.

lambdalisue avatar Oct 11 '16 11:10 lambdalisue

Sorry for the delay!

According to the issue you linked, the version warning is harmless. In the other cases, it was not accompanied by failing to enable vim. However, the solution (disabling the version warning) was supposed to be implemented in the new release, and the fact that it doesn't seem to be in my case may provide a clue for why I'm failing to use vim. I don't know how though. Do you have other suggestions? Please let me know if you need more info.

egorananyev avatar Nov 11 '16 01:11 egorananyev

Hum... I'm not sure but removing/renaming ~/.jupyter/nbconfig/notebook.json may help? (I have no idea what is a corresponding file in Windows).

lambdalisue avatar Nov 11 '16 07:11 lambdalisue

Just tried that, i.e., renamed notebook.json to notebook_bak.json. Unfortunately, it didn't help :/

egorananyev avatar Nov 11 '16 08:11 egorananyev

How about jupyter nbextension enable vim_binding\vim_binding while you are on Windows

lambdalisue avatar Nov 11 '16 08:11 lambdalisue

In the description of the issue, I've written that this is the command that gives me the error message that I also included above. I am running it on Windows through babun (cygwin).

egorananyev avatar Nov 11 '16 13:11 egorananyev

I have same problem while using cygwin and solved it after some analysis. The real problem is the line

mkdir -p $(jupyter --data-dir)/nbextensions

The data-dir have a newline that got included into the created directory name which is 'jupyter'$'\r'. If you look in the windows explorer the name is jupyter (the last character looks like a dot). Lastly if you tried to tab complete the directory name you get jupyter^M

So the solution is to not use --data-dir but be at %APPDATA% and create jupyter/nbextensions directory. Oh and I don't think creating jupyter directory is necessary because it is already there. I believe this is a cygwin specific problem.

Now I am able to enable the vim_binding :).

DancingQuanta avatar Dec 01 '16 16:12 DancingQuanta

Thanks! That's nearly impossible to notice.... Does the way @DancingQuanta suggest the issue? @egorananyev

lambdalisue avatar Dec 02 '16 07:12 lambdalisue

Excellent, it's working! To summarize DancingQuanta, the jupyter directory name created by the mkdir command is incorrect ("jupyter^M" instead of "jupyter"). Moving the nbextensions from that directory to the already existing Roaming/jupyter directory resolves the issue.

For new installations, instead of creating this jupyter^M directory with the command, you should: $ cd /cygdrive/c/Users/YourUserName/AppData/Roaming/jupyter $ mkdir nbextensions $ cd nbextensions $ git clone https://github.com/lambdalisue/jupyter-vim-binding vim_binding $ jupyter nbextension enable vim_binding/vim_binding

Perhaps this could be included in the package documentation?

Great job @DancingQuanta for spotting this!

egorananyev avatar Dec 04 '16 03:12 egorananyev

I opened an issue over at Jupyter about this to see if they could remove that last newline jupyter/notebook#1937.

DancingQuanta avatar Dec 04 '16 10:12 DancingQuanta

Thanks! Hope the issue is fixed in the jupyter side....

lambdalisue avatar Dec 04 '16 11:12 lambdalisue

Hello Friends:

I seem to have hit this issue on Fedora-28/Linux. Oddly, I had this working fine (100% perfectly) once before, but I put jupyter away for about a year and upon return today vim keystrokes weren't being respected. So I re-ran the following, and this time got the error (whereas I didn't originally):

From inside the nbextensions/ directory ...

user@fedora28$ ${JUPYTER_VENV_HOME}/bin/jupyter --version
4.4.0

user@fedora28$ ls -la vim_binding/
total 48
drwxr-xr-x 6 user user  4096 Nov 28 20:41 .
drwxr-xr-x 3 user user  4096 Nov 28 20:24 ..
drwxr-xr-x 8 user user  4096 Nov 28 20:24 .git
drwxr-xr-x 2 user user  4096 Nov 28 20:24 .github
drwxr-xr-x 3 user user  4096 Nov 28 20:24 lib
-rw-r--r-- 1 user user 11989 Nov 28 20:24 README.md
drwxr-xr-x 2 user user  4096 Nov 28 20:24 resource
-rw-r--r-- 1 user user   625 Nov 28 20:24 vim_binding.css
-rw-r--r-- 1 user user  2860 Nov 28 20:24 vim_binding.js
-rw-r--r-- 1 user user   174 Nov 28 20:24 vim_binding.yaml

user@fedora28$ ${JUPYTER_VENV_HOME}/bin/jupyter nbextension enable vim_binding/vim_binding
Enabling notebook extension vim_binding/vim_binding...
      - Validating: problems found:
        - require?  X vim_binding/vim_binding

Note that ${JUPYTER_VENV_HOME} is simply the jupyter version that is inside a virtual environment I created for using jupyter notebooks.

Any ideas? Thank you in advance. :)

EDIT: I gave up trying to get this to work and went searching for an alternative. That search led me to JupyterLab which, according to its documentation, is the next-generation web-based user interface for Project Jupyter. It offers a vim key binding out of the box (among others) and is user selectable. I hope this helps.

nmvega avatar Nov 29 '18 02:11 nmvega

My experience may help the issue of vim-binds extension being invalid after re-install.

What happened

  • One sentence version: The vim-bind extension [@axlair/jupyterlab_vim] remained invalid after reinstall, however the jupyter labestension list told me everything is fine.

  • Long story version: I installed vim-binds extension at first. Then I remove it (for some stupid reason...). After that, I installed vim-binds extension again, and since then, the vim-binds remains invalid. Even the jupyter labextension list command told me the extension is enabled ok.

My solution

  • One sentence version: The extension can be successfully reinstalled and enabled again, by removing the extension from the list of Uninstalled core extensions.

  • Long story version: Then I noticed that the extension was also listed in the Uninstalled core extensions. So I cd into the app dir (mine is C:\Users\[Username]\Anaconda3\share\jupyter\lab). Open the file of settings\build_config.json. And remove the extension name in the uninstalled_core_extensions session. After that, re-open the jupyter-lab server can automatically re-install the extension, and the program automatically re-install the extension, until everything went fine.

Analysis

My best guess is that

  • The invalid of the extension after re-install is because the program can not load it correctly.
  • The reason of fail on loading is it being listed in the uninstalled_core_extensions.
  • By removing it from there, the program can finally realize the extension should being re-installed.

Hence solved.

listenzcc avatar Dec 23 '20 04:12 listenzcc