Closed jrouly closed 1 year ago
It is on the PATH (in the R environment), and JupyterLab is clearly aware of this since it's able to run notebooks on the R kernel just fine
These are two different paths, so knowing that one works does not help with the other really.
- Install jupyterlab, jupyterhub into the
jupyter
environment- Install R, r-irkernel, r-languageserver into the
R
environment
Currently detection of R language sever comes down to what Rscript -e cat(system.file(package='languageserver'))
returns in the environment where jupyter-server gets spawned (in your case jupyter
).
When you install kernelspec It would technically be possible to use path from kernel spec it creates a JSON file like this:
{
"argv": ["/a/path/to/your/R", "--slave", "-e", "IRkernel::main()", "--args", "{connection_file}"],
"display_name": "R",
"language": "R"
}
While we could potentially check for kernelspecs contents it is not currently implemented. We would need to extract /a/path/to/your/R
bit and use it instead of Rscript
. One would need to find a clean way to obtain it for currently running kernel (as you could have multiple different versions of IRKernel installed).
Maybe of more use for now, you can create custom serverspecs pointing to any executable you would like, see https://jupyterlab-lsp.readthedocs.io/en/latest/Configuring.html#
Let's consolidate the discussion in #533 which was opened earlier and has more replies.
While we could potentially check for kernelspecs contents it is not currently implemented. We would need to extract /a/path/to/your/R bit and use it instead of Rscript. One would need to find a clean way to obtain it for currently running kernel (as you could have multiple different versions of IRKernel installed).
A concrete idea for instead modifying the kernelspecs was proposed in https://github.com/jupyter-lsp/jupyterlab-lsp/issues/533#issuecomment-1763201392.
I'm not 100% sure if this is the correct repository to file this issue so please forgive me in advance if I've bungled this.
What I am trying to do...
I'm trying to run JupyterHub with an R kernel, using Conda (micromamba) to manage environments, with an R language server.
The steps I've followed are essentially:
jupyterlab
,jupyterhub
into thejupyter
environmentR
,r-irkernel
,r-languageserver
into theR
environmentR
environment and invokeIRkernel::installspec(user = FALSE, prefix = '$JUPYTER_HOME')
This works great and sets up an R kernel. However, despite having installed
r-languageserver
(which I can confirm by runninglibrary(languageserver)
in a notebook), JupyterLab is unable to detect the R language server. It complains:and recommends I troubleshoot finding
Rscript
on thePATH
. It is on the PATH (in theR
environment), and JupyterLab is clearly aware of this since it's able to run notebooks on the R kernel just fine. And yet, it cannot find the language server.How I would like to learn how to do it...
I think the instructions in the documentation are pretty clear as-is, this was a very unexpected case. Having a section of documentation specifically for cross-environment kernels would potentially be helpful.
How the project might keep the docs accurate...
Having an additional section to the installation documentation to help with cross-account server scenarios could probably address this.