lambdalisue / jupyter-vim-binding

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

Failing to enable vim_binding; validation issues #86

Open egorananyev opened 8 years ago

egorananyev commented 8 years ago

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

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.

lambdalisue commented 8 years ago

Unrecognized JSON config file version, assuming version 1

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

egorananyev commented 8 years ago

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.

lambdalisue commented 8 years ago

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).

egorananyev commented 8 years ago

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

lambdalisue commented 8 years ago

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

egorananyev commented 8 years ago

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).

DancingQuanta commented 8 years ago

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 :).

lambdalisue commented 8 years ago

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

egorananyev commented 8 years ago

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!

DancingQuanta commented 8 years ago

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

lambdalisue commented 8 years ago

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

nmvega commented 6 years ago

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.

listenzcc commented 3 years ago

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

What happened

My solution

Analysis

My best guess is that

Hence solved.