jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 127

Running this command from RStudio will show this error. When you run this command from command line/ terminal then everything will be fine.

So just type R from your command line.

Then Run below commands:

install.packages('devtools')

devtools::install_github('IRkernel/IRkernel')

enter image description here

IRkernel::installspec()

  1. If Anaconda is installed and the Jupyter-Notebook with it (should be the standard install), open up the Anaconda prompt, not the Windows command prompt or the Anaconda Navigator
  2. Look up the executable of R (not Rgui or Rstudio), it should be somewhere like C:\Program Files\R\R-3.5.1\bin and remember the path typing cd C:\Program Files\R\R-3.5.1\bin and start R by typing R
  3. typing IRkernel::installspec()
  4. Now you can start an R kernel within Jupyter-Notebook

On some Windows systems you may not succeed even if you run R from cmd / powershell. That's the case on my machine. My workaround is to run R from Anaconda Prompt (if you installed Jupyter via Anaconda). You may need to specify the full path if R is not on your PATH.

I think this is some problem related to the PATH, however I had no luck adding Anaconda\Lib\site-packages\jupyter_client to my system PATH.