n-riesco / ijavascript

IJavascript is a javascript kernel for the Jupyter notebook
Other
2.19k stars 185 forks source link

Windows error Error running `jupyter kernelspec install' on windows 10 #133

Closed josephtan closed 6 years ago

josephtan commented 6 years ago

Hi all,

I'm having similar issue when running "ijsinstall" or "ijs", and does anyone here know how to edit the cmd file for the command to execute as "jupyter-kernelspec" instead of "jupyter kernelspec" ?

I am well aware of having 2 python versions on my machine so I have uninstalled python 2.7 and removing the environment paths in windows but it seems not to work.

Are there any other workable suggestions?

Thank you.

Error:

D:\Anaconda>ijs Error running jupyter kernelspec install --replace C:\Users\username\AppData\Lo cal\Temp\7fc7c6641f9defe1d7cb4db35bc82cb5\javascript --user Error: Command failed: jupyter kernelspec install --replace C:\Users\username\Ap pData\Local\Temp\7fc7c6641f9defe1d7cb4db35bc82cb5\javascript --user Error executing Jupyter command 'kernelspec': [Errno 'jupyter-kernelspec' not found] 2

n-riesco commented 6 years ago

The way I'm reading the error message is that jupyter-kernelspec is missing (or most likely not in your %PATH%).

I'd guess that Anaconda has been installed without updating %PATH% and for that reason it isn't available to other programs in your computer.

I can see that Anaconda doesn't recommend to update your %PATH%.

I've tested the installation instruction here still work for me:

  1. Open the Anaconda Prompt
  2. Install Node.js: conda install nodejs
  3. Install IJavascript: npm install -g ijavascript
  4. Install IJavascript's kernelspec: ijsinstall
  5. Open the Jupyter Notebook.
  6. Click on New > Javascript (Node.js)
josephtan commented 6 years ago

@n-riesco Actually when typing down jupyter-kernelspec the cmd terminal list out the subcommand list.

What the 'ijs' command trying to execute is jupyter kernelspec without the hyphen so is there anyway to change the executable?

The same goes for jupyter-notebook rather the default jupyter notebook.

n-riesco commented 6 years ago

@josephtan See my updated comment above.

Did you run ijs from within the Anaconda prompt?

n-riesco commented 6 years ago

One more thing, I really recommend to install IJavascript's kernelspec with ijsinstall (which by default hides undefined execution results). ijs is only kept for backwards-compatibility.

josephtan commented 6 years ago

I did the steps from 1-3 but when it comes to step 4 I'm getting the same error.

(D:\Anaconda) C:\Users\JosephTan>ijsinstall Error running jupyter kernelspec install --replace C:\Users\JosephTan\AppData\Local\Temp\1a28c89e86be5956261c7b949764942d\javascript --user Error: Command failed: jupyter kernelspec install --replace C:\Users\JosephTan\AppData\Local\Temp\1a28c89e86be5956261c7b949764942d\javascript --user Error executing Jupyter command 'kernelspec': [Errno 'jupyter-kernelspec' not found] 2 Error executing Jupyter command 'kernelspec': [Errno 'jupyter-kernelspec' not found] 2

n-riesco commented 6 years ago

What version of Anaconda are you using? I've tested Anaconda3-5.0.1-Windows-x86_64.exe and the instructions work.

n-riesco commented 6 years ago

In the past both Jupyter and Anaconda have had issues with linking to jupyter-kernelspec, but they have been fixed in their latest versions.

Here's a link to the instructions to upgrade jupyter: http://jupyter.readthedocs.io/en/latest/projects/upgrade-notebook.html#upgrading-jupyter-notebook-using-anaconda

josephtan commented 6 years ago

version 4.3.30 as per conda command.

Could you check if ijsinstall works for this version?

josephtan commented 6 years ago

Yes, it is the Anaconda3 5.0.1-Windows-x86_64.exe as downloaded on the website.

n-riesco commented 6 years ago

I've also got 4.3.30. When you open the Anaconda Navigator, what version of Jupyter do you see?

n-riesco commented 6 years ago

So if we both have the same version, my guess is that you also have a second installation of Jupyter.

What do you get when you run where jupyter and where jupyter-kernelspec inside the Anaconda Prompt and inside Power Shell?

From the Anaconda prompt I get:

(C:\Users\User\Anaconda3) C:\Users\User>where jupyter
C:\Users\User\Anaconda3\Scripts\jupyter.exe

(C:\Users\User\Anaconda3) C:\Users\User>where jupyter-kernelspec
C:\Users\User\Anaconda3\Scripts\jupyter-kernelspec.exe

But from Power Shell I get nothing:

PS C:\Users\User> where jupyter
PS C:\Users\User> where jupyter-kernelspec
PS C:\Users\User>
josephtan commented 6 years ago

Jupyter version after update: (D:\Anaconda)C:\Users\JosephTan>jupyter --version 4.3.0

Anaconda prompt:

(D:\Anaconda) C:\Users\JosephTan>where jupyter D:\Anaconda\Scripts\jupyter.exe (D:\Anaconda) C:\Users\JosephTan>where jupyter-kernelspec D:\Anaconda\Scripts\jupyter-kernelspec.exe

Nothing in power shell either:

PS C:\Users\JosephTan> where jupyter PS C:\Users\JosephTan> where jupyter-kernel

n-riesco commented 6 years ago

That all looks like on my setup. Does ijsinstall work now in the Anaconda Prompt?

josephtan commented 6 years ago

Nope, is throwing up the same error.

(D:\Anaconda) C:\Users\JosephTan>ijsinstall

Error runningjupyter kernelspec install --replace`

C:\Users\JosephTan\AppData\Local\Temp\cc527cc71a71476f3fbabb78e1c8bcce\javascript --user

Error: Command failed: jupyter kernelspec install --replace

C:\Users\JosephTan\AppData\Local\Temp\cc527cc71a71476f3fbabb78e1c8bcce\javascript --user

Error executing Jupyter command 'kernelspec': [Errno 'jupyter-kernelspec' not found] 2

Error executing Jupyter command 'kernelspec': [Errno 'jupyter-kernelspec' not found] 2

n-riesco commented 6 years ago

did you use conda to install nodejs?

josephtan commented 6 years ago

Yes and its all through the Anaconda prompt.

However conda list returns nodejs with 0 on it?

nltk 3.2.4 py36hd0e0a39_0 nodejs 6.10.3 0 nose 1.3.7 py36h1c3779e_2 notebook 5.0.0 py36hd9fbf6f_2

n-riesco commented 6 years ago

All that looks OK. I can't think of anything else that explains what you see.

If you want to, we can try to install the kernel spec manually:

First you need to create a folder named javascript:

(C:\Users\User\Anaconda3) C:\Users\User>mkdir javascript

Inside the javascript folder, you need to:

(C:\Users\User\Anaconda3) C:\Users\User>copy C:\Users\User\Anaconda3\Library\bin\node_modules\ijavascript\images\logo-32x32.png javascript
        1 file(s) copied.

(C:\Users\User\Anaconda3) C:\Users\User>copy C:\Users\User\Anaconda3\Library\bin\node_modules\ijavascript\images\logo-64x64.png javascript
        1 file(s) copied.

(C:\Users\User\Anaconda3) C:\Users\User>type javascript\kernel.json
{
        "argv": [
          "ijskernel.cmd",
          "{connection_file}",
          "--protocol=5.0"
        ],
        "display_name": "Javascript (Node.js)",
        "language": "javascript"
}

(C:\Users\User\Anaconda3) C:\Users\User>dir javascript
 Volume in drive C has no label.
 Volume Serial Number is 02B4-3556

 Directory of C:\Users\User\javascript

11/28/2017  03:48 AM    <DIR>          .
11/28/2017  03:48 AM    <DIR>          ..
11/28/2017  03:42 AM               237 kernel.json
11/28/2017  02:02 AM             1,239 logo-32x32.png
11/28/2017  02:02 AM             2,738 logo-64x64.png
               3 File(s)          4,214 bytes
               2 Dir(s)  92,847,783,936 bytes free

(C:\Users\User\Anaconda3) C:\Users\User>

Once you're done with the javascript folder, the command to register the javascript folder as a kernelspec is:

(C:\Users\User\Anaconda3) C:\Users\User>jupyter kernelspec install --replace javascript --user
[InstallKernelSpec] Removing existing kernelspec in C:\Users\User\AppData\Roaming\jupyter\kernels\javascript
[InstallKernelSpec] Installed kernelspec javascript in C:\Users\User\AppData\Roaming\jupyter\kernels\javascript

And to confirm a javascript kernel spec has been registered:

(C:\Users\User\Anaconda3) C:\Users\User>jupyter kernelspec list --json
{
  "kernelspecs": {
    "javascript": {
      "resource_dir": "C:\\Users\\User\\AppData\\Roaming\\jupyter\\kernels\\javascript",
      "spec": {
        "argv": [
          "ijskernel.cmd",
          "{connection_file}",
          "--protocol=5.0"
        ],
        "env": {},
        "display_name": "Javascript (Node.js)",
        "language": "javascript"
      }
    },
    "python3": {
      "resource_dir": "C:\\Users\\User\\Anaconda3\\share\\jupyter\\kernels\\python3",
      "spec": {
        "argv": [
          "C:\\Users\\User\\Anaconda3\\python.exe",
          "-m",
          "ipykernel_launcher",
          "-f",
          "{connection_file}"
        ],
        "env": {},
        "display_name": "Python 3",
        "language": "python"
      }
    }
  }
}

(C:\Users\User\Anaconda3) C:\Users\User>

Please, let me know if you get stuck with any of the steps above.

josephtan commented 6 years ago

It's working now.

I've started jupyter-notebook on the Anaconda command prompt and I'm able to see Javascript (Node.js)on Newpulldown menu.

I did a test run as per git homepage and the server is able to produce the same result on the Out line.

Thanks.