Ask Your Question
1

Sage on Jupyter - socket error

asked 2019-08-09 15:56:52 -0600

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
1

answered 2019-08-10 09:44:30 -0600

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 06:59:59 -0600 )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 15:56:52 -0600

Seen: 91 times

Last updated: Aug 10