Skip to content

Commit 25c0a75

Browse files
author
Matthias Koeppe
committed
src/doc/en/installation/launching.rst: Update jupyter section for venv
1 parent c5af195 commit 25c0a75

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

src/doc/en/installation/launching.rst

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -125,14 +125,20 @@ convenience, it is possible to link your installation of SageMath into
125125
your Jupyter installation, adding it to the list of available kernels
126126
that can be selected in the notebook or JupyterLab interface.
127127

128-
If ``$SAGE_LOCAL`` is the installation prefix of your Sage
129-
installation (the default is ``$SAGE_ROOT/local``) and you can start
130-
the Jupyter notebook by typing ``jupyter notebook``, then the
131-
following command will install SageMath as a new kernel.
128+
Assuming that SageMath can be invoked by typing ``sage``, you can use
132129

133130
.. CODE-BLOCK:: bash
134131
135-
jupyter kernelspec install --user $SAGE_LOCAL/share/jupyter/kernels/sagemath
132+
sage -sh -c 'ls -d $SAGE_VENV/share/jupyter/kernels/sagemath'
133+
134+
to find the location of the SageMath kernel description.
135+
136+
Assuming that the Jupyter notebook can be started by typing ``jupyter notebook``,
137+
the following command will install SageMath as a new kernel.
138+
139+
.. CODE-BLOCK:: bash
140+
141+
jupyter kernelspec install --user $(sage -sh -c 'ls -d $SAGE_VENV/share/jupyter/kernels/sagemath')
136142
137143
This installs the kernel under the name ``sagemath``. If you wish to
138144
rename it to something more specific in order to distinguish between
@@ -141,32 +147,35 @@ different installations of SageMath, you can use the additional option
141147

142148
.. CODE-BLOCK:: bash
143149
144-
jupyter kernelspec install --user $SAGE_LOCAL/share/jupyter/kernels/sagemath --name sagemath-dev-worktree
150+
jupyter kernelspec install --user $(sage -sh -c 'ls -d $SAGE_VENV/share/jupyter/kernels/sagemath') --name sagemath-dev-worktree
145151
146152
The ``jupyter kernelspec`` approach by default does lead to about 2Gb of
147-
sagemath documentation being copied into your personal jupyter configuration
153+
SageMath documentation being copied into your personal jupyter configuration
148154
directory. You can avoid that by instead putting a symlink in the relevant spot.
149-
Assuming that sagemath is properly installed, you can use
155+
and
150156

151157
.. CODE-BLOCK:: bash
152158
153-
sage -sh -c 'ls -d $SAGE_LOCAL/share/jupyter/kernels/sagemath'
159+
jupyter --paths
154160
155-
to find location of the sagemath kernel description and
161+
to find valid data directories for your Jupyter installation.
162+
A command along the lines of
156163

157164
.. CODE-BLOCK:: bash
158165
159-
jupyter --paths
166+
ln -s $(sage -sh -c 'ls -d $SAGE_VENV/share/jupyter/kernels/sagemath') $HOME/.local/share/jupyter
160167
161-
to find valid data directories for your jupyter installation.
162-
A command along the lines of
168+
can then be used to create a symlink to the SageMath kernel description
169+
in a location where your own ``jupyter`` can find it.
170+
171+
If you have installed SageMath from source, the alternative command
163172

164173
.. CODE-BLOCK:: bash
165174
166-
ln -s `sage -sh -c 'ls -d $SAGE_LOCAL/share/jupyter/kernels/sagemath'` $HOME/.local/share/jupyter
175+
ln -s $(sage -sh -c 'ls -d $SAGE_ROOT/venv/share/jupyter/kernels/sagemath') $HOME/.local/share/jupyter
167176
168-
can then be used to create a symlink to the sagemath kernel description
169-
in a location where your own ``jupyter`` can find it.
177+
creates a symlink that will stay current even if you switch to a different Python version
178+
later.
170179

171180
To get the full functionality of the SageMath kernel in your global
172181
Jupyter installation, the following Notebook Extension packages also

0 commit comments

Comments
 (0)