jupyter-client has to be installed but “jupyter ke

2019-02-02 07:02发布

问题:

I have already installed Jupyter notebook in my ubuntu 16.04 machine. In jupyter notebook there is by default python installed. Now I want to use R from jupyter notebook.

To do so I followed IRkernel installation link and run below commands:

install.packages('devtools')

devtools::install_github('IRkernel/IRkernel')

But when I run IRkernel::installspec() command it shows below error:

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

I am now confused why this error occurs.

回答1:

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


回答2:

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.



回答3:

I have solved with this:

sudo ln -s /home/'my user name'/anaconda3/bin/jupyter /usr/bin/jupyter



回答4:

I had the same error but the fix was different:

Make sure you also have anaconda install on your system! (or at least jupyter) https://conda.io/docs/user-guide/install/index.html



回答5:

Adding this for anyone, who googling and getting stuck on this issue may benefit from this simple learning. I got the same error, as above, followed the instructions above (while launching R in Terminal):

IRkernel::installspec() 
Error in IRkernel::installspec() : 
    jupyter-client has to be installed but “jupyter kernelspec --version” exited with code 127.

In Bash I ran:

Mac-Pro:~ $ jupyter kernelspec --version
-bash: jupyter: command not found

Duh, I had no Jupyter installed. Install Jupyter (on mac, using brew) with: brew install jupyter. Installation instructions for other OS's can be found here.

All now working fine.



回答6:

I had the same error, but in my case, I have jupyter installed in a virtual environment, so I had to start R after installing the virtual environment in order for IRkernel::installspec() to succeed.



回答7:

I had the same issue; I added the following in the ~/.bashrc (and source) and then tried running IRkernel::installspec() and it worked:

export PATH="~/anaconda3/bin:$PATH"


回答8:

Here a way to overcome this problem. I have installed IRkernel with anaconda in my mac (I guess is the same on Linux)

I typed:

conda install -c r r-irkernel

Then I started started R typing:

R

Finally, I have install the kernelspec to tell Jupyter about IRkernel, with the option user=FALSE for installation in the global environment:

IRkernel::installspec(user=FALSE)

Hope it helps!



回答9:

I had the same problem but none of the above solutions worked for me. I was using Debian 9 with the default versions of python and R. I had to delete installed programs and compile latest versions of both from source. For Python compiling I had to use this configuration https://github.com/sloria/TextBlob/issues/173



回答10:

  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