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')
IRkernel::installspec()
Cannot get IRkernel::installspec() to work, jupyter-client not visible
This answer is based on this by @Ryan, but since the question answered was actually about a Linux based system I put it here in a Windows question:
One way to overcome the problem - if adding PATH variables to the environment doesn't work - is the following:
- 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
- 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 copy the path - Paste the path into the Anaconda prompt and start R by typing
R
- Now execute
IRkernel::installspec()
once again, this time there shouldn't be an error - Now you can start an R kernel within Jupyter-Notebook
In IRKernel::installspec(): jupyter kernelspec --version exits with code one
I posted the Error executing Jupyter command 'kernelspec'
issue here:
Jupyter commands work only with a dash (e.g. jupyter-kernelspec instead of jupyter kernelspec)
To install the R Kernel, the workaround I used was to tweak the installspec function's code and execute this tweaked version locally.
The modification was to replace:
17: exit_code <- system2('jupyter', c('kernelspec', '--version'), FALSE, FALSE)
42: args <- c('kernelspec', 'install', '--replace', '--name', name, user_flag, prefix_flag, file.path(tmp_name, 'kernelspec'))
43: exit_code <- system2('jupyter', args)
By:
17: exit_code <- system2('jupyter-kernelspec', '--version', FALSE, FALSE)
42: args <- c('install', '--replace', '--name', name, user_flag, prefix_flag, file.path(tmp_name, 'kernelspec'))
43: exit_code <- system2('jupyter-kernelspec', args)
EDIT A better, simpler workaround here:
Jupyter commands work only with a dash (e.g. jupyter-kernelspec instead of jupyter kernelspec)
How to install Jupyter Lab/Notebook on Windows 10?
Please check if jupyter is in your user/system path. A quick way to check is by running jupyter in the command line, you could use powershell commandline:
Get-Command jupyter
CommandType Name Version Source
----------- ---- ------- ------
Application jupyter.exe 0.0.0.0 C:\Users\youruser\AppData\Local\Programs\...
If it's not there, then you can add to your system/user path and check with new instance of commandline again.
Error code 127 when adding R kernal to Jupyter Notebook
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.
Related Topics
R Column Check If Contains Value from Another Column
How to Make a Post Request with Header and Data Options in R Using Httr::Post
How to Save a Plot Made with Ggplot2 as Svg
Change the Index Number of a Dataframe
Putting X-Axis at Top of Ggplot2 Chart
Use Dplyr's Summarise_Each to Return One Row Per Function
Traceback() for Interactive and Non-Interactive R Sessions
Ggplot/Mapping Us Counties - Problems with Visualization Shapes in R
How to Create a Time-Spiral Graph Using R
Side by Side Histograms in the Same Graph in R
R Aggregate Data in One Column Based on 2 Other Columns
R: Replace All Values in a Dataframe Lower Than a Threshold with Na
How to Calculate the 95% Confidence Interval for the Slope in a Linear Regression Model in R
How to Make Object Created Within Function Usable Outside
Rmarkdown: Pandoc: PDFlatex Not Found
Specifying Column Types When Importing Xlsx Data to R with Package Readxl