1

So I've installed SageMath through anaconda with conda install sage python jupyterlab.

I then go to install the sage jupyter kernel as in this thread via jupyter kernelspec install --user ~/miniconda3/envs/sage/share/jupyter/kernels/sagemath

But this command fails with the following error

Traceback (most recent call last):
  File "/Users/llamagod/miniconda3/envs/sage/bin/jupyter-kernelspec", line 10, in <module>
    sys.exit(KernelSpecApp.launch_instance())
  File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/site-packages/traitlets/config/application.py", line 845, in launch_instance
    app.start()
  File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/site-packages/jupyter_client/kernelspecapp.py", line 266, in start
    return self.subapp.start()
  File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/site-packages/jupyter_client/kernelspecapp.py", line 132, in start
    self.kernel_spec_manager.install_kernel_spec(self.sourcedir,
  File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/site-packages/jupyter_client/kernelspec.py", line 340, in install_kernel_spec
    shutil.copytree(source_dir, destination)
  File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/shutil.py", line 557, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
  File "/Users/llamagod/miniconda3/envs/sage/lib/python3.9/shutil.py", line 513, in _copytree
    raise Error(errors)
shutil.Error: [('/Users/llamagod/miniconda3/envs/sage/share/jupyter/kernels/sagemath/doc', '/Users/llamagod/Library/Jupyter/kernels/sagemath/doc', "[Errno 2] No such file or directory: '/Users/llamagod/miniconda3/envs/sage/share/jupyter/kernels/sagemath/doc'")]

I tried symlinking $SAGE_LOCAL/share/doc to that directory but I get the same error.

SageMath 9.2, JupyterLab 3.0.16

Is this a known issue ?

GreenLlama
  • 123
  • 1
  • 6

1 Answers1

1

In the end I used the alternate method described on this page to install the kernel and avoid copying over the documentation.

ln -s `sage -sh -c 'ls -d $SAGE_LOCAL/share/jupyter/kernels/sagemath'` $HOME/miniconda3/envs/sage/share/jupyter

So I can now run the sagemath kernel from the jupyter in my conda environment.

GreenLlama
  • 123
  • 1
  • 6