Onega

a lot of VC++ posts, a few C# posts, and some miscellaneous stuff

Friday, January 01, 2021

SageMath 9.2 error on macOS Catalina 10.15.5 ModuleNotFoundError: No module named '_ssl'

SageMath 9.2 start up error on macOS Catalina 10.15.5:

/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/traitlets/config/loader.py:795: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(key) is 1:
/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/traitlets/config/loader.py:804: SyntaxWarning: "is" with a literal. Did you mean "=="?
  if len(key) is 1:
Traceback (most recent call last):
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/sage/repl/ipython_kernel/install.py", line 307, in have_prerequisites
    from notebook.notebookapp import NotebookApp
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/notebook/notebookapp.py", line 66, in <module>
    from tornado import httpserver
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/tornado/httpserver.py", line 29, in <module>
    import ssl
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24                     │
│ Using Python 3.8.5. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
Please wait while the Sage Jupyter Notebook server starts...

The Jupyter notebook requires ssl, even if you do not use
https. Install the openssl development packages in your system and
then rebuild Python (sage -f python3).

Traceback (most recent call last):
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/sage/repl/ipython_kernel/install.py", line 307, in have_prerequisites
    from notebook.notebookapp import NotebookApp
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/notebook/notebookapp.py", line 66, in <module>
    from tornado import httpserver
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/site-packages/tornado/httpserver.py", line 29, in <module>
    import ssl
  File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/ssl.py", line 98, in <module>
    import _ssl             # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24                     │
│ Using Python 3.8.5. Type "help()" for help.                        │
└────────────────────────────────────────────────────────────────────┘
Please wait while the Sage Jupyter Notebook server starts...

The Jupyter notebook requires ssl, even if you do not use
https. Install the openssl development packages in your system and
then rebuild Python (sage -f python3).

[I 17:44:32.483 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.js
[I 17:44:33.670 NotebookApp] The port 8888 is already in use, trying another port.
[I 17:44:33.672 NotebookApp] Serving notebooks from local directory: /Users/onzhang/Documents/jupyter
[I 17:44:33.673 NotebookApp] Jupyter Notebook 6.1.1 is running at:
[I 17:44:33.673 NotebookApp] http://localhost:8889/?token=bfcacfc9fff13ce43129cae1535e1eaf55638cf81e3baa30
[I 17:44:33.673 NotebookApp]  or http://127.0.0.1:8889/?token=bfcacfc9fff13ce43129cae1535e1eaf55638cf81e3baa30
[I 17:44:33.673 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 17:44:33.684 NotebookApp]
    
    To access the notebook, open this file in a browser:
        file:///Users/onzhang/Library/Jupyter/runtime/nbserver-36662-open.html
    Or copy and paste one of these URLs:
        http://localhost:8889/?token=bfcacfc9fff13ce43129cae1535e1eaf55638cf81e3baa30
     or http://127.0.0.1:8889/?token=bfcacfc9fff13ce43129cae1535e1eaf55638cf81e3baa30
[I 17:44:46.884 NotebookApp] Kernel started: 0bdf8030-8556-4d1a-b2e5-0551a02e8938, name: sagemath
[I 17:46:46.881 NotebookApp] Saving file at /sagemath1.ipynb

Solution:

https://ask.sagemath.org/question/51130/ssl-error-using-sage-pip-install-to-download-a-package/

/Applications/SageMath-9.2.app/sage -python -m fix_mac_sage9_2.fix

Labels: