Skip to content

Commit 9a069bf

Browse files
author
Release Manager
committed
Trac #29291: Check for required extension module "ssl" in python3 build and spkg-configure
Follow up from #27705. As openssl has been a standard package since Sage 9.3, there is no more point in accepting system python3 without ssl support or ignoring errors in building the ssl module when building the python3 spkg. As SSL issues are no longer a likely diagnosis for failures with launching the notebook, we change the corresponding code in `src/bin /sage-notebook`. (Prompted by https://groups.google.com/g/sage- devel/c/IXypXTbVkDM/m/CsWl8HbZAwAJ) URL: https://trac.sagemath.org/29291 Reported by: mkoeppe Ticket author(s): Matthias Koeppe Reviewer(s): John Palmieri
2 parents c975efe + 789c960 commit 9a069bf

File tree

3 files changed

+21
-12
lines changed

3 files changed

+21
-12
lines changed

build/pkgs/python3/spkg-build.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ fi
107107
echo "Testing importing of various modules..."
108108
import_errors=false
109109
# Trac #31160: We no longer check for readline here.
110-
test_modules="ctypes math hashlib crypt socket zlib sqlite3"
110+
test_modules="ctypes math hashlib crypt socket zlib sqlite3 ssl"
111111
if [ "$UNAME" = "Darwin" ]; then
112112
test_modules="$test_modules _scproxy"
113113
fi

build/pkgs/python3/spkg-configure.m4

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ SAGE_SPKG_CONFIGURE([python3], [
2323
dnl Check if we can do venv with a system python3
2424
dnl instead of building our own copy.
2525
dnl Trac #31160: We no longer check for readline here.
26-
check_modules="sqlite3, ctypes, math, hashlib, crypt, socket, zlib, distutils.core"
26+
check_modules="sqlite3, ctypes, math, hashlib, crypt, socket, zlib, distutils.core, ssl"
2727
AC_CACHE_CHECK([for python3 >= ]MIN_VERSION[, < ]LT_VERSION[ with modules $check_modules], [ac_cv_path_PYTHON3], [
2828
AS_IF([test x"$ac_path_PYTHON3" != x], [dnl checking explicitly specified $with_python
2929
AC_MSG_RESULT([])

src/bin/sage-notebook

+19-10
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,10 @@ logger = logging.getLogger()
1313
from sage.misc.banner import banner
1414

1515

16-
class NotebookJupyter(object):
16+
_system_jupyter_url = "https://doc.sagemath.org/html/en/installation/launching.html#setting-up-sagemath-as-a-jupyter-kernel-in-an-existing-jupyter-notebook-or-jupyterlab-installation"
17+
1718

18-
PREREQUISITE_ERROR = textwrap.dedent("""
19-
The Jupyter notebook requires ssl, even if you do not use
20-
https. Install the openssl development packages in your system and
21-
then rebuild Python (sage -f python3).
22-
""")
19+
class NotebookJupyter(object):
2320

2421
def print_banner(self):
2522
banner()
@@ -31,11 +28,18 @@ class NotebookJupyter(object):
3128

3229
def __init__(self, argv):
3330
self.print_banner()
34-
from sage.repl.ipython_kernel.install import have_prerequisites
35-
if not have_prerequisites():
36-
print(self.PREREQUISITE_ERROR)
31+
try:
32+
from notebook.notebookapp import main
33+
except ImportError:
34+
import traceback
35+
traceback.print_exc()
36+
print("The Jupyter notebook is not installed (at least not in this Sage installation).")
37+
print("You can install it by running")
38+
print(" sage -i notebook")
39+
print("Alternatively, you can follow the instructions at")
40+
print(" " + _system_jupyter_url)
41+
print("to use Sage with an existing Jupyter notebook installation.")
3742
raise SystemExit(1)
38-
from notebook.notebookapp import main
3943
main(argv)
4044

4145

@@ -52,12 +56,17 @@ class NotebookJupyterlab(object):
5256
try:
5357
from jupyterlab.labapp import main
5458
except ImportError:
59+
import traceback
60+
traceback.print_exc()
5561
print("Jupyterlab is not installed (at least not in this Sage installation).")
5662
print("You can install it by running")
5763
print(" sage -i jupyterlab_widgets")
5864
print("which includes support for interacts and the ability to download and")
5965
print("install other Jupyterlab extensions. For a minimal installation, run")
6066
print(" sage -i jupyterlab")
67+
print("Alternatively, you can follow the instructions at")
68+
print(" " + _system_jupyter_url)
69+
print("to use Sage with an existing Jupyterlab installation.")
6170
raise SystemExit(1)
6271
self.print_banner()
6372
main(argv)

0 commit comments

Comments
 (0)