3

I'm trying to flesh out the workflow for a JupyterHub server in the case where a user creates an environment and wants to share it with another user. I want to test out one of the two methods.

I am trying to create an environment in a public path, and then have another user add the conda environment as a kernel. So far it looks like this.

# How the environment is created
jupyter@ip:~$ conda create -p /home/envs/test --clone root

# Current setup
nick {~}$ jupyter kernelspec list
Available kernels:
  python3    /opt/conda/share/jupyter/kernels/python3
nick {~}$ conda env list
# conda environments:
#
test                     /home/envs/test
nenv                     /home/nick/.conda/envs/nenv
base                  *  /opt/conda

nick {~}$ cat .condarc
envs_dirs:
  - /home/envs

My problem is I get an error when I try and install the kernel libstdc++.so.6.0.21 does not exist. What is libstdc++.so.6.0.21?

# error when trying to install kernel
nick {~}$ jupyter kernelspec install --user /home/envs/test
[InstallKernelSpec] Removing existing kernelspec in /home/nick/.local/share/jupyter/kernels/test
Traceback (most recent call last):
  File "/opt/conda/bin/jupyter-kernelspec", line 11, in <module>
    sys.exit(KernelSpecApp.launch_instance())
  File "/opt/conda/lib/python3.7/site-packages/traitlets/config/application.py", line 658, in launch_instance
    app.start()
  File "/opt/conda/lib/python3.7/site-packages/jupyter_client/kernelspecapp.py", line 273, in start
    return self.subapp.start()
  File "/opt/conda/lib/python3.7/site-packages/jupyter_client/kernelspecapp.py", line 143, in start
    replace=self.replace,
  File "/opt/conda/lib/python3.7/site-packages/jupyter_client/kernelspec.py", line 346, in install_kernel_spec
    shutil.copytree(source_dir, destination)
  File "/opt/conda/lib/python3.7/shutil.py", line 365, in copytree
    raise Error(errors)
shutil.Error: [('/home/envs/test/lib/libstdc++.so.6.0.21', '/home/nick/.local/share/jupyter/kernels/test/lib/libstdc++.so.6.0.21', "[Errno 2] No such file or directory: '/home/envs/test/lib/libstdc++.so.6.0.21'")]

Note: I found this question which is similar; however, I found through this github thread why gcc had to be removed, and I already verified that it didn't exist in my environment with:

nick {~}$ conda list --name test | grep 'gcc'
_libgcc_mutex             0.1                        main  
libgcc                    7.2.0                h69d50b8_2  
libgcc-ng                 8.2.0                hdf63c60_1

I already have libgcc installed at a higher version as you can see above so I didn't think the other answer would do too much good either.


filename shows up as red with this, so I believe the link is broken.

(test) nick {~}$ ls -al /home/envs/test/lib/libstdc++.so.6.0.21
lrwxrwxrwx 1 jupyter jupyter 19 Aug  9 09:42 /home/envs/test/lib/libstdc++.so.6.0.21 -> libstdc++.so.6.0.24
Nick Brady
  • 6,084
  • 1
  • 46
  • 71

1 Answers1

1

I realized I was using jupyter kernelspec in a non-intended way here. It is not intended to actually create the kernel, but only to add a kernelspec if it exists (see here, at the bottom).

There are two options for writing a kernel:

  1. You can reuse the IPython kernel machinery to handle the communications, and just describe how to execute your code. This is much simpler if the target language can be driven from Python. See Making simple Python wrapper kernels for details.
  2. You can implement the kernel machinery in your target language. This is more work initially, but the people using your kernel might be more likely to contribute to it if it’s in the language they know.

So, in my case what I really wanted to do was use IPythons utilities (option 1 above) which is documented well here. In which case to add the shared conda environment as a kernel in a way the users can access it I just need to run.

su - <user>
conda activate test
python -m ipykernel install --user --name test --display-name "Python (test)" 
Nick Brady
  • 6,084
  • 1
  • 46
  • 71