Jupyterhub: Kernels in different environments not working

Hi,
I’m not able to get xeus-cling- and R-kernel to work in jupyterlab or notebook startet from jupyterhub.
My system : Ubuntu 22.04 with miniconda3 installed in /opt.
I have an environment for jupyterhub (jupyterhubenv) and one for xeus-cling (xeusclingenv) and one for R (R-env).
It works, when I install “nb_conda_kernels” and start the jupyterhub in the jupyterhubenv-console. But when I start jupyterhub over systemd, then all kernels disappear. I tried also to start a bash-script with systemd, in which I activated the jupyterhubenv before I startet jupytherhub. But also without success.

Another way: I tried to install the kernels manually like this:

(jupyterhubenv): jupyter kernelspec install /opt/miniconda3/envs/xeus-cling/share/jupyter/kernels/xcpp14/ --sys-prefix

then the kernels are all listet in jupyterlab, but can not be executed. It crashes with errors like

ERROR in cling::CIFactory::createCI(): cannot extract standard library include paths!
Invoking:
LC_ALL=C x86_64-conda-linux-gnu-c++ -O3 -DNDEBUG -xc++ -E -v /dev/null 2>&1 | sed -n -e ‘/^.include/,${’ -e ‘/^ /.*++/p’ -e ‘}’
Results was:
With exit code 0
input_line_1:1:10: fatal error: ‘new’ file not found
#include

What I want is to start jupyterhub as a systemd-service and all kernels from different environments to work. I would prefer the manual way instead of “nb_conda_kernels”
I’m new to all this stuff, but got the task, to provide a jupyterhub-server.

Thanks in advance

Thomas

I’m a few steps further … I activated my xeusclingenv and executed the command
xcpp --verbose
So I could see all the includes xcpp uses. I opened the file

/opt/miniconda3/envs/jupyterhubenv/share/jupyter/kernels/xcpp17/kernel.json

which was created by the “jupyter kernelspec install”-command and attached all this includes
like this
“argv”: [
“/opt/miniconda3/envs/xeus-cling/bin//xcpp”,
.
.
“-I”,
“/opt/miniconda3/envs/xeus-cling/include”

and now the xcpp17-kernel seems to work.

The same was with the kernel for R. I installed into the jupyterenv again with

jupyter kernelspec install /opt/miniconda3/envs/R_env/share/jupyter/kernels/ir/ --sys-prefix

and had to edit the kernel,json.
There was only the R-coomand. I needed to attach the full path to the R-command.

Do I miss a step installing kernels into the jupyterhubenv ? Or is this the “normal” way, that the created kernel.json has to be adapted ?

Thomas