Ask Your Question
2

Sage on Jupyter - socket error

asked 2019-08-09 22:56:52 +0100

Richard_L gravatar image

When I try to start sage with the Jupyter notebook, I get this error:

:~/work> sage -n jupyter
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.8, Release Date: 2019-06-26                     │
│ Using Python 2.7.15. Type "help()" for help.                       │
└────────────────────────────────────────────────────────────────────┘
Please wait while the Sage Jupyter Notebook server starts...
[I 13:23:55.592 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.js
[I 13:23:55.773 NotebookApp] Writing notebook server cookie secret to /run/user/1002/jupyter/notebook_cookie_secret
Traceback (most recent call last):
  File "/home/rllozes/sage-8.8/src/bin/sage-notebook", line 267, in <module>
    launcher(unknown)
  File "/home/rllozes/sage-8.8/src/bin/sage-notebook", line 99, in __init__
    main(argv)
  File "/home/rllozes/sage-8.8/local/lib/python2.7/site-packages/jupyter_core/application.py", line 266, in launch_instance
    return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)
  File "/home/rllozes/sage-8.8/local/lib/python2.7/site-packages/traitlets/config/application.py", line 657, in launch_instance
    app.initialize(argv)
  File "<decorator-gen-7>", line 2, in initialize
  File "/home/rllozes/sage-8.8/local/lib/python2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error
    return method(app, *args, **kwargs)
  File "/home/rllozes/sage-8.8/local/lib/python2.7/site-packages/notebook/notebookapp.py", line 1635, in initialize
    self.init_webapp()
  File "/home/rllozes/sage-8.8/local/lib/python2.7/site-packages/notebook/notebookapp.py", line 1407, in init_webapp
    self.http_server.listen(port, self.ip)
  File "/home/rllozes/sage-8.8/local/lib/python2.7/site-packages/tornado/tcpserver.py", line 142, in listen
    sockets = bind_sockets(port, address=address)
  File "/home/rllozes/sage-8.8/local/lib/python2.7/site-packages/tornado/netutil.py", line 197, in bind_sockets
    sock.bind(sockaddr)
  File "/home/rllozes/sage-8.8/local/lib/python2.7/socket.py", line 230, in meth
    return getattr(self._sock,name)(*args)

socket.error: [Errno 99] Cannot assign requested address

Any idea why I get a socket error?

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
3

answered 2019-08-10 16:44:30 +0100

Richard_L gravatar image

I discovered on StackOverflow that some jupyter installations require specifying the ip address of localhost. So,

sage -n jupyter --ip=127.0.0.1

does the trick!

This seems to be a quirk of jupyter, since the classic sage notebook interface finds localhost just fine.

edit flag offensive delete link more

Comments

Normally this should not be necessary, but I think on some systems, depending on your permissions, it won't bind to 0.0.0.0 by default.

Iguananaut gravatar imageIguananaut ( 2019-08-14 13:59:59 +0100 )edit

Thanks a lot for the note to start it with sage -n jupyter --ip=127.0.0.1

I got "OSError: [Errno 99] Cannot assign requested address", but the same trick worked!

I compiled sage 9.1 with both python 2 and 3, both produce the same error messages. First I had to stumble into the fact that sagenb has been replaced with jupyter - by accident, the transition does not seem to be well documented. Then I found similar hints about the IP on non-sage places which didn't help me since sage -h or -advanced does not list this --ip option.

gg@g gravatar imagegg@g ( 2020-09-15 19:45:41 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2019-08-09 22:56:52 +0100

Seen: 874 times

Last updated: Sep 15 '20