Ask Your Question
0

Error while running jupyter with sage

asked 2019-12-06 12:55:24 -0500

anonymous user

Anonymous

updated 2019-12-16 08:15:09 -0500

Iguananaut gravatar image

I just recently upgraded my sage to sage 8.9

However, opening jupyter notebook from sage has stopped functioning.

Previously I used to be able to do the following:

$ sage -n jupyter

And this would open jupyter notebook for me with the option of using either sage or python kernel.

When I do the same thing, I now get the following error:

Please wait while the Sage Jupyter Notebook server starts...

[I 13:51:32.844 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.js

[I 13:51:34.199 NotebookApp] Serving notebooks from local directory: /Users/sunroseshrestha

[I 13:51:34.200 NotebookApp] The Jupyter Notebook is running at:

[I 13:51:34.200 NotebookApp] http://localhost:8888/?token=9ab97f6290fb5f9743fc5f08ff0f296bced77cc85c2f2763

[I 13:51:34.200 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip 
confirmation).

Traceback (most recent call last):

  File "/Applications/SageMath/src/bin/sage-notebook", line 267, in <module>
    launcher(unknown)

  File "/Applications/SageMath/src/bin/sage-notebook", line 99, in __init__
    main(argv)

  File "/Applications/SageMath/local/lib/python3.7/site-packages/jupyter_core/application.py", line 266, in launch_instance

return super(JupyterApp, cls).launch_instance(argv=argv, **kwargs)

  File "/Applications/SageMath/local/lib/python3.7/site-packages/traitlets/config/application.py", line 658, in launch_instance

app.start()

  File "/Applications/SageMath/local/lib/python3.7/site-packages/notebook/notebookapp.py", line 1791, in start
self.launch_browser()

  File "/Applications/SageMath/local/lib/python3.7/site-packages/notebook/notebookapp.py", line 1731, in launch_browser

browser = webbrowser.get(self.browser or None)

  File "/Applications/SageMath/local/lib/python3.7/webbrowser.py", line 42, in get
    register_standard_browsers()

  File "/Applications/SageMath/local/lib/python3.7/webbrowser.py", line 530, in register_standard_browsers
    raw_result = subprocess.check_output(cmd, stderr=subprocess.DEVNULL)

  File "/Applications/SageMath/local/lib/python3.7/subprocess.py", line 395, in check_output
    **kwargs).stdout

  File "/Applications/SageMath/local/lib/python3.7/subprocess.py", line 472, in run
    with Popen(*popenargs, **kwargs) as process:

  File "/Applications/SageMath/local/lib/python3.7/subprocess.py", line 775, in __init__
    restore_signals, start_new_session)

  File "/Applications/SageMath/local/lib/python3.7/subprocess.py", line 1522, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)

NotADirectoryError: [Errno 20] Not a directory: 'xdg-settings'

How would I fix this?

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted
3

answered 2019-12-06 21:15:12 -0500

Emmanuel Charpentier gravatar image

The error you report seems to point to a configuration problem specific to your system: your OS (presumaby Linux) tries to open a browser to display Jupyter's home page, but can't, due to a misconfiguration of your system's default application : "xdg-settings" is a shell script that retrieves, in this case, the parameters necessary to open your default browser, but not the directory expected (apparently) by the Sage (sub)process trying to open the browser.

To confirm this, try to see if you can open a browser window from the command line by trying, for example

s xdg-open https://www.google.com

If your browser does not open the home page of Google, this is quite probably due to the same problem ; see the next paragraph. However, if it does open this page, the problem is different, the, the problem may be different, and possibly Sage-related. You should try to post a detailed report to the sage-support forum/mailing list, rather than on the present site, more oriented to mathematical and Sage-related programming questions.

If it turns out it is a configuration problem, since you give no information about your operating system, configuration, etc..., I can't say anything else. Your best source of information about your system is probably the documentation relevant to your desktop environment, and, possibly, the mailing lists/fora dedicated to your operating system.

HTH,

edit flag offensive delete link more

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-12-06 12:55:24 -0500

Seen: 546 times

Last updated: Dec 16 '19