ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 05 Feb 2020 09:38:30 -0600Sage notebook only runs when a browser is already openhttp://ask.sagemath.org/question/49804/sage-notebook-only-runs-when-a-browser-is-already-open/I just installed sage 8.8 (it's not the newest sage, but it works for the most part) on my Linux machine and I had everything working at some point but the other day it isn't working as I'd expect it to be. When I do
$ sage -n jupyter --browser=firefox
in the terminal without Firefox opened, I get
┌────────────────────────────────────────────────────────────────────┐
│ 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 09:42:16.791 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.js
[I 09:42:17.016 NotebookApp] The port 8888 is already in use, trying another port.
[I 09:42:17.016 NotebookApp] The port 8889 is already in use, trying another port.
[I 09:42:17.017 NotebookApp] The port 8890 is already in use, trying another port.
[I 09:42:17.017 NotebookApp] The port 8891 is already in use, trying another port.
[I 09:42:17.017 NotebookApp] The port 8892 is already in use, trying another port.
[I 09:42:17.023 NotebookApp] Serving notebooks from local directory: /home/user
[I 09:42:17.023 NotebookApp] The Jupyter Notebook is running at:
[I 09:42:17.024 NotebookApp] <local host>
[I 09:42:17.024 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:42:17.027 NotebookApp]
To access the notebook, open this file in a browser:
<server file>
Or copy and paste one of these URLs:
<localhost>
(I don't have enough karma to actually post the links but "local host" is the link to the notebook and "server file" is the HTML file in "/var/run/user/.../nbserver-...-open.html") which seems fine but Firefox doesn't appear to be open. When I try to open another Firefox browser, I get a message saying that there is already another browser opened when there isn't and I would have to kill the Firefox processes in order to open it again. Interestingly, when I try the same command again with a browser already opened, a new tab with the sage notebook appears.
I get the feeling that the problem could be coming from my init.sage file but I'm not sure if that would be the case.
~/.sage/init.sage:
==================================
from sage.misc.viewer import viewer
viewer.browser('open -a /usr/bin/firefox')
My environment variable SAGE_BROWSER is set to firefox:
$ echo $SAGE_BROWSER
firefox
If there's anything else that you'd like me to provide, let me know.BudRzWed, 05 Feb 2020 09:38:30 -0600http://ask.sagemath.org/question/49804/Output of @interact disappears when exporting Jupyter notebook to HTMLhttp://ask.sagemath.org/question/48563/output-of-interact-disappears-when-exporting-jupyter-notebook-to-html/I would like to write a Jupyter notebook that includes some interacts. When I export it to HTML the output of cells containing an interact disappears completely. The following screen captures shows the problem: the notebook is shown above, the corresponding HTML page appears below.
![image description](/upfiles/1572489201647630.png)
![image description](/upfiles/15724893284633615.png)
I was hoping that, at least, an image of the initial state of the interact will be shown. Is there a way to automatically replace the interact output by an image when exporting to HTML?JuanjoWed, 30 Oct 2019 21:37:13 -0500http://ask.sagemath.org/question/48563/Problems with AMS symbols in Sage, Jupyterhttp://ask.sagemath.org/question/48303/problems-with-ams-symbols-in-sage-jupyter/ How to display the square (\square) symbol in a graph (Jupyter, maybe not only). Why \boxtimes is too large?
plot(x, (x,-1,10), axes_labels=[r'$F(G\,\square\,H)$',r'$F(G\,\times\,H)$']).show()
plot(x, (x,-1,10), axes_labels=[r'$F(G\,\square\,H)$',r'$F(G\,\times\,H)$']).show()
I tried \box \square \emptybox etc. and
from sage.misc.latex import latex_extra_preamble
latex.add_to_preamble('\\usepackage{amssymb}')
I get:
ValueError:
F(G\,\square\,H)
^
Unknown symbol: \square (at char 5), (line:1, col:6)
SYLASat, 12 Oct 2019 09:42:12 -0500http://ask.sagemath.org/question/48303/interact button reacting twicehttp://ask.sagemath.org/question/48338/interact-button-reacting-twice/I'm trying to update some old interact to the new Jupyter notebook. I'd like
to have an interact with buttons, something like the following:
act = []
@interact
def play(move=selector([None] + ["Auto", "Reset"], buttons=True)):
act.append(move)
print(act)
However when I press a new button, the applet receive it twice. For example,
if I press "Auto" and the "Reset" it prints
[None, 'Auto', 'Auto', 'Reset', 'Reset']
instead of
[None, 'Auto', 'Reset']
Is it expected ? HivertMon, 14 Oct 2019 14:16:47 -0500http://ask.sagemath.org/question/48338/Problems with AMS symbols in Sage, Jupyterhttp://ask.sagemath.org/question/48302/problems-with-ams-symbols-in-sage-jupyter/ How to display the square (\square) symbol in a graph (Jupyter, maybe not only). Why \boxtimes is too large?
plot(x, (x,-1,10), axes_labels=[r'$F(G\,\square\,H)$',r'$F(G\,\times\,H)$']).show()
plot(x, (x,-1,10), axes_labels=[r'$F(G\,\square\,H)$',r'$F(G\,\times\,H)$']).show()
I tried \box \square \emptybox etc. and
from sage.misc.latex import latex_extra_preamble
latex.add_to_preamble('\\usepackage{amssymb}')
I get:
ValueError:
F(G\,\square\,H)
^
Unknown symbol: \square (at char 5), (line:1, col:6)
SYLASat, 12 Oct 2019 09:39:14 -0500http://ask.sagemath.org/question/48302/Sage on Jupyter - socket errorhttp://ask.sagemath.org/question/47455/sage-on-jupyter-socket-error/ 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?
Richard_LFri, 09 Aug 2019 15:56:52 -0500http://ask.sagemath.org/question/47455/Convert existing notebook to Jupyterhttp://ask.sagemath.org/question/47140/convert-existing-notebook-to-jupyter/ Hi, I try to pass from sagenb to jupyter. I follow the recommandation on trac.sagemath.org
When I run the command
> sage -n export --list
I obtain the following error.
Traceback (most recent call last):
File "/usr/bin/sage-notebook", line 266, in <module>
launcher(unknown)
File "/usr/bin/sage-notebook", line 135, in __init__
os.execvp(SAGENB_EXPORT, [SAGENB_EXPORT] + argv)
File "/usr/lib/python2.7/os.py", line 346, in execvp
_execvpe(file, args)
File "/usr/lib/python2.7/os.py", line 382, in _execvpe
func(fullname, *argrest)
OSError: [Errno 2] No such file or directory
Thanks for your helpfylouFri, 12 Jul 2019 07:09:40 -0500http://ask.sagemath.org/question/47140/Interact layout in Jupyter-Notebookhttp://ask.sagemath.org/question/47120/interact-layout-in-jupyter-notebook/When I run this code
@interact(layout=dict(top=[['f', 'color']],
left=[['axes'],['fill']],
bottom=[['zoom']]))
def _(f=input_box(x^2,width=20),
color=color_selector(widget='colorpicker', label=""),
axes=True,
fill=True,
zoom=range_slider(-3,3, default=(-3,3))):
show(plot(f,(x,zoom[0], zoom[1]), color=color, axes=axes,fill=fill))
in Jupyter notebook, the controls are not organised as specified. But this is not so with the old SageNB notebook. How can I make the controls specified in the `layout` parameter to appear in the output as originally specified? Please advise.eocanseyWed, 10 Jul 2019 16:49:30 -0500http://ask.sagemath.org/question/47120/Opening "old" Sage Notebooks in Jupyter: not UTF-8 encodedhttp://ask.sagemath.org/question/46943/opening-old-sage-notebooks-in-jupyter-not-utf-8-encoded/I've decided to pay attention to the "Sage Notebook is Deprecated" message at the top of all of my Notebooks, and convert everything into Jupyter. So it seems that I'm got Jupyter running on my system (through Anaconda), but when I save all my SageMath notebooks (as .sws files, since that seems to happen by default), and open them in Jupyter, (I'm running Jupyter with "sage -n jupyter"), I get the message in the notebook that the file is not UTF-8 encoded, and nothing else (sorry, I can't for the life of me seem to cut and paste this exact message from the Jupyter notebook...).
I did a little searching and at least discovered this:
$ file -bi Embedded\ Torus\ in\ Invariant\ Coordinates\ \(S3\ Scale\ Factor\,\ Bump\).sws
$ application/x-bzip2; charset=binary
So this file (and all my Sage Notebook Files) have "binary" listed as the character set. That seems bad to me - if it's a character set, shouldn't it be ASCII at least, or something?
Anyone know how I can get these notebooks into Jupyter? I can go back and save them as something different if I knew what I needed to do.thethinkerWed, 19 Jun 2019 09:32:32 -0500http://ask.sagemath.org/question/46943/Sage Notebook crashes immediatelyhttp://ask.sagemath.org/question/46075/sage-notebook-crashes-immediately/New installation of Windows binaries, version 8.6 (Windows installer 0.4.2), on 64-bit Windows 8.1 system with 8GB of RAM. Clicking on the "SageMath 8.6 Notebook" desktop icon opens a terminal window and displays the message "Please wait while the Sage Jupyter Notebook server starts", but the window closes within 2 or 3 seconds.
Would appreciate any guidance on troubleshooting - happy to study any relevant documentation if someone can point me in the right direction.
When running `sage --notebook=jupyter` in the shell I get:
[I 17:51:21.659 NotebookApp] Using MathJax: nbextensions/mathjax/MathJax.js Traceback (most recent call last):
File "/opt/sagemath-8.6/src/bin/sage-notebook", line 268, in <module> launcher(unknown)
File "/opt/sagemath-8.6/src/bin/sage-notebook", line 100, in __init__ main(argv)
File "/opt/sagemath-8.6/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 "/opt/sagemath-8.6/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 "/opt/sagemath-8.6/local/lib/python2.7/site-packages/traitlets/config/application.py", line 87, in catch_config_error return method(app, args, *kwargs)
File "/opt/sagemath-8.6/local/lib/python2.7/site-packages/notebook/notebookapp.py", line 1629, in initialize self.init_webapp()
File "/opt/sagemath-8.6/local/lib/python2.7/site-packages/notebook/notebookapp.py", line 1408, in init_webapp self.http_server.listen(port, self.ip)
File "/opt/sagemath-8.6/local/lib/python2.7/site-packages/tornado/tcpserver.py", line 142, in listen sockets = bind_sockets(port, address=address)
File "/opt/sagemath-8.6/local/lib/python2.7/site-packages/tornado/netutil.py", line 197, in bind_sockets sock.bind(sockaddr)
File "/opt/sagemath-8.6/local/lib/python2.7/socket.py", line 230, in meth return getattr(self._sock,name)(*args)
socket.error: [Errno 1] Operation not permittedrixensoTue, 09 Apr 2019 23:57:42 -0500http://ask.sagemath.org/question/46075/add entire tab column in Jupyter notebook?http://ask.sagemath.org/question/45048/add-entire-tab-column-in-jupyter-notebook/Hi
Just to point out that it's a pity, that pressing the alt key,
simultaneously with a continuous press on the left mouse button,
which allows you to delete or add an entire column of characters in Word, Google Doc, or Notepad ++,
does not exist in Jupyter-notebook editor.
Is there a way to add an entire tab column in Jupyter-notebook editor ?.
So far, when I have to move a block of code on the side,
I copy it in Notepad ++ and I use the alt key, and then I re-copy it in the editor Jupyter-notebook. ortolljTue, 15 Jan 2019 01:09:25 -0600http://ask.sagemath.org/question/45048/How to configure jupyter for Sage-specific use?http://ask.sagemath.org/question/45025/how-to-configure-jupyter-for-sage-specific-use/I am an absolute beginner in using jupyter-notebooks.
Since SageMath version 8.5 the user is asked to be prepared for using jupyter as the standard notebook in the future.
So, in Linux I activate jupyter with ./ sage -n jupyter and do some experiments.
In this way, obviously, SageMath activates an internal jupyter package via an internal notebook-interface (and not via an external jupyter installation e.g. in anaconda).
I tried also to edit python code within a jupyter cell. I got some unexpected errors, so editing code in jupyter cells seems to be problematic. Also, I want to figure out, why editing python code within a jupyter cell changes the color marks of some 'if' statements to red? Sometimes, after re-opening a closed jupyter session appears as plain text only, i.e., without cells.
My simple question is therefore: Is there any documentation available for the sage-specific use of jupyter (e.g., meaning of color code for the elements of the python language, extra necessary import of additional sage objects for jupyter, configuration of jupyter, etc)?.
bekalphSat, 12 Jan 2019 11:00:58 -0600http://ask.sagemath.org/question/45025/