rwindowsjupyter-notebookjupyter-irkernel

Error code 127 when adding R kernal to Jupyter Notebook


I am aware that this question has been asked before but it was a long time ago and all of the advice in the thread didn't work for me. I have anaconda installed on my Windows 10 computer. Jupyter Notebook works fine but I want to add the R kernel. I have installed the IRkernel package and ran IRkernel::installspec() but I get the error message:

Error in IRkernel::installspec() :
jupyter-client has to be installed but "jupyter kernelspec --version" exited with code 127.
In addition: Warning message:
running command '"jupyter" kernelspec --version' had status 127

I ran this in the R console and I have added C:\ProgramData\Anaconda3\Lib\site-packages\jupyter_client and C:\ProgramData\Anaconda3\Scripts to the system PATH as advised in the old question but to no avail. Is there any advice specific to my setup (as the previous question was for an Ubuntu machine) that would fix this?


Solution

  • Ah I figured out what I needed to do. I'll leave an answer here in case anyone else has the same issue in the future.

    Executing from either RStudio or R console wasn't working. Instead I had to run R in the anaconda console and then run the command and it worked without an error.