ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 14 May 2021 04:08:57 +0200Can't Run Macaulay2 via SageMath in Jupyter Notebookhttps://ask.sagemath.org/question/57112/cant-run-macaulay2-via-sagemath-in-jupyter-notebook/ I am attempting to access Macaulay2 via Sage in a Jupyter Notebook, but Sage can't find macaulay2. Any attempt to call macaulay2, such as,
```
macaulay2('3/5 + 7/11')
```
raises a chain of error messages; the first one reading, `ExceptionPexpect: The command was not found or was not executable: M2`. The other errors are similar, "Your attempt to start Macaulay2 failed, either because you do not have Macaulay2 installed, or because it is not configured correctly".
Addressing the suggested fixes from this output:
- Macaulay2 is installed on my computer, and is in the default location (`/usr/local/bin/M2`);
- It starts from the terminal (both terminal.app and the jupyter terminal) with `M2`;
- When I run sage in either terminal, it can run Macaulay2.
I also downloaded the most recent release of Sage, but the problem persists.
Are there any suggestions as to the cause of this issue or a fix?mcummingsFri, 14 May 2021 04:08:57 +0200https://ask.sagemath.org/question/57112/interact: different behavior concerning **kwargs in SageCell an Jupyter notebookhttps://ask.sagemath.org/question/56620/interact-different-behavior-concerning-kwargs-in-sagecell-an-jupyter-notebook/I'm trying to use the output of one interact as the input for number of control elements in a second interact. The following examle code works in Sage Jupyter notebook but fails in SageCell (Unfortunately I can't post a link to SageCell due to my low karma).
I don't understand why it fails and how I can make the code run in SageCell.
@interact
def f(s=slider([1,2], default=1)):
kwargs = { f"C_{i}": checkbox() for i in range(s)}
print(kwargs)
@interact(**kwargs)
def f2(**kwargs):
for key, value in kwargs.items():
print(f"{key} is {value}")
VittMon, 12 Apr 2021 01:35:24 +0200https://ask.sagemath.org/question/56620/Jupyter notebook: plot() fails to produce graphhttps://ask.sagemath.org/question/55991/jupyter-notebook-plot-fails-to-produce-graph/ Just installed Sage on my Windows 10 machine. When I try to run plot(sin, (0.0, 10.0)), or any other plot, I only get the error message: "The kernel appears to have died. It will restart automatically." What can I do?
Thanks for your help.
BobbobmccroryTue, 02 Mar 2021 05:44:48 +0100https://ask.sagemath.org/question/55991/TypeError: 'tuple' object is not callable on notebook but not on terminalhttps://ask.sagemath.org/question/55874/typeerror-tuple-object-is-not-callable-on-notebook-but-not-on-terminal/Code :
x=var('x')
y=function('y')(x)
k= var('k')
assume(k>0)
harmonic2 = diff(y,x,2)+k*y == 0
desolve(harmonic2, y, ivar = x)
Error :
TypeError Traceback (most recent call last) <ipython-input-54-ef4195c42a80> in <module>
4 assume(k>Integer(0))
5 harmonic2 = diff(y,x,Integer(2))+k*y == Integer(0)
----> 6 desolve(harmonic2, y, ivar = x)
TypeError: 'tuple' object is not callable
Why does this happen when i tried it in notebook but when i tried it in notepad but it ran fine on the terminalmath1styearstudentWed, 24 Feb 2021 12:41:31 +0100https://ask.sagemath.org/question/55874/Link between notebookshttps://ask.sagemath.org/question/55434/link-between-notebooks/ I wonder if it is possible to link two notebooks. That is open a notebook aware of the code in an other ?CyrilleSun, 24 Jan 2021 10:39:08 +0100https://ask.sagemath.org/question/55434/Is there any way to use SageMath on macOS Big Sur??https://ask.sagemath.org/question/54238/is-there-any-way-to-use-sagemath-on-macos-big-sur/I downloaded SageMath-9.2 on my mac,but every time I try ro use the notebook (by running "sage -n jupyter" on my terminal) I get the following massage:
" Please wait while the Sage Jupyter Notebook server starts... 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 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 import ssl File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/ssl.py", line 98, in import _ssl # if we can't import it, let the error propagate ModuleNotFoundError: No module named '_ssl'
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). " And also I can't open the app either for some reason ..... every time I click on the app I get a small window saying : "Jupyter Server failed to start" "For some reason the Jupyter server failed to start. Please check the log for clues, and have that information handy when asking for help."
I hope for some help, its very important for me because I must use SageMath for my college project.. thanks in advanceSafa AmashaSat, 14 Nov 2020 22:26:23 +0100https://ask.sagemath.org/question/54238/Creating a file for user defined functions using JupyterLab environment.https://ask.sagemath.org/question/54105/creating-a-file-for-user-defined-functions-using-jupyterlab-environment/I want to create a function in a separate file, and use that function in another one.
Here is the example:
#my_file.ipynb
def my_function(n):
return n*2
#main.ipnyb
attach('my_file.ipynb')
my_function(2)
But when doing this at the JupyterLab I receive the following erros:
(1) ValueError: unknown file extension '.ipynb' for load or attach (supported extensions: .py, .pyx, .sage, .spyx, .f, .f90, .m)
(2) NameError: name 'my_function' is not defined
This method seems to work for ***.sage*** files, but is not working for ***'.ipynb'***.
There is some way to accomplish the result demonstrated through my example using only JupyterLab environment?OshioTue, 03 Nov 2020 00:49:22 +0100https://ask.sagemath.org/question/54105/How to add .sws notebook files to SageNB so that I can convert them into .ipynb?https://ask.sagemath.org/question/53703/how-to-add-sws-notebook-files-to-sagenb-so-that-i-can-convert-them-into-ipynb/I have a bunch of .sws files, that were made (I suppose) with the now-deprecated sage notebook. Currently the default notebook application for Sage files is Jupyter, which cannot open these files. I tried
1. Using the built in "sagenb-export" command (ask.sagemath.org/question/35873/how-to-automatically-convert-many-sws-to-ipynb/) and also a standalone package (github.com/vbraun/ExportSageNB) in order to do it, but the notebook list in sagenb is empty (`sagenb-export --list` shows an empty list) and I could not make it to convert files that are not on this list. When running `sage -n`, there is an option "Convert old notebooks to Jupyter", but the list below that line is empty as well Is there a way of importing .sws files into this list?
2. An alternative way was to use the `-sws2rst` and `-rst2ipynb` flags that I found in an answer here (ask.sagemath.org/question/35873/how-to-automatically-convert-many-sws-to-ipynb/?answer=38197#post-id-38197), but that gives me `ModuleNotFoundError: No module named 'sagenb'`. Is it possible to install the sagenb module?RolfFri, 02 Oct 2020 16:07:19 +0200https://ask.sagemath.org/question/53703/EOL error in Sage-9.1https://ask.sagemath.org/question/53682/eol-error-in-sage-91/I want to modify a Python package for solving 'Quasi normal modes' using SageMath if possible, I want the below error to be fixed.
?qnm.modes_cache
grav_220 = qnm.modes_cache(s=-2, l=2, m=2, n=0)
omega, A, C = grav_220(a=0.68)
print('ω={}, A={}'.format(omega, A))
print('C={}''.format(C))
I get the error for the second input as
File "<ipython-input-13-1f77b2f8a4ef>", line 4
print('C={}''.format(C))
^
SyntaxError: EOL while scanning string literalsaxadThu, 01 Oct 2020 10:08:30 +0200https://ask.sagemath.org/question/53682/Sage on Jupyter - socket errorhttps://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 22:56:52 +0200https://ask.sagemath.org/question/47455/I broke jupyter (again)https://ask.sagemath.org/question/52313/i-broke-jupyter-again/I was trying to install some dark themes, so I ran
$ sage --pip install jupyterthemes
followed by
$ sage --pip install --upgrade jupyterthemes
as suggested [here](https://github.com/dunovank/jupyter-themes).
Then, when I launch
$ sage -n jupyter
the server seems to open correctly, but when trying to open an `.ìpynb` file, I get
500: internet server error
Sage itself is running, from the command line everything is o.k. More than that, running
$ sage -n jupyterlab
gives no problem at all: I can still run my notebooks.
Running sage 9.1 on Ubuntu 18.04. At some point I installed `hide_code` as per
[this thread](https://ask.sagemath.org/question/50277/how-to-install-hide_code-in-sagemath/).
Perhaps my problem comes from some broken dependencies?JCFri, 03 Jul 2020 14:33:08 +0200https://ask.sagemath.org/question/52313/inline help feature not working on jupyter notebookhttps://ask.sagemath.org/question/52746/inline-help-feature-not-working-on-jupyter-notebook/In prior Sage things that I've used, to get help with a particular function, say `matrix`, I would type `matrix?` then hit tab. However, this isn't working for me in the Jupyter notebook. avi.steinerWed, 29 Jul 2020 18:47:26 +0200https://ask.sagemath.org/question/52746/How to plot in seperate window using Jupyter notebook?https://ask.sagemath.org/question/52524/how-to-plot-in-seperate-window-using-jupyter-notebook/ Hello Guys,
I spend quite some time approximating a 1-manifold via a list of points, that I now want to plot. Is there a way to have a nice big window showing the interactive plot, instead of the small image, which is shown inline per default?
I'm using something like
plot = list_plot(firstList, plotjoined=True, color = 'blue')
plot += list_plot(secondList, plotjoined=True, color = 'red')
to plot two components of the manifold in one image. Sorry, but I can't show an screenshot of the output, because I'm new here and missing points (<60) to upload :( Alternatively, I tried adjusting the figsize, but nothing changed that way.
Thank you for your help!PaulEbertFri, 17 Jul 2020 11:17:39 +0200https://ask.sagemath.org/question/52524/Question about Jupyterhttps://ask.sagemath.org/question/51186/question-about-jupyter/ I am nearly novice in Sagemath and I would like to ameliorate the display of the cells.
For this I would like to install `Hide_code` but I am on windows 10 and the procedure to follow are written for Linux.
My second question is why Jupyter comes on windows ten without `view`?CyrilleFri, 01 May 2020 15:33:58 +0200https://ask.sagemath.org/question/51186/How to add extensions to Jupyter?https://ask.sagemath.org/question/51101/how-to-add-extensions-to-jupyter/Hi,
One can add extensions to Jupyter, as explained on the
[jupyter-contrib-nbextensions installation page](https://jupyter-contrib-nbextensions.readthedocs.io/en/latest/install.html),
for instance with the instruction:
pip install jupyter_contrib_nbextensions
But this instruction does not work using the SageMath 9.0 Shell (in Windows)... Any idea what to do?
RolandrolandTue, 28 Apr 2020 14:03:35 +0200https://ask.sagemath.org/question/51101/Table frame not showing in Jupyter Notebook and inconsistent in other environmentshttps://ask.sagemath.org/question/50600/table-frame-not-showing-in-jupyter-notebook-and-inconsistent-in-other-environments/ Hello, Sage community!
The `table` command in Sage has this useful option called `frame`. If I set `frame=True` in SageCell, CoCalc, the Sage terminal and SageTeX, the result is the expected: a frame is shown for the corresponding table. However, the same command does not work properly in Jupyter Notebooks. Also, the results are quite different in SageCell and CoCalc.
The following three images show the result of executing the following commands:
rows = [[100,2,3], [4,5,60]]
t = table(rows, frame=True)
show(t)
This is the result in SageCell:
![image description](/upfiles/15861892266090416.png)
This is the result in CoCalc:
![image description](/upfiles/1586189242468030.png)
This is the result in Jupyter (executed using `sage -n jupyter`):
![image description](/upfiles/15861892732930594.png)
Here are my questions:
1. Why is the `frame=True` option not working in Jupyter?
2. Why the difference in the results?
3. Is there any way to make these results consistent through these environments?dsejasMon, 06 Apr 2020 18:10:42 +0200https://ask.sagemath.org/question/50600/buttons on interact acting twice first timehttps://ask.sagemath.org/question/50325/buttons-on-interact-acting-twice-first-time/Hi
Ubuntu 18.04 Jupyter notebook SageMath 9.0
Q1):
I can't find why the first time I click on r or on t buttons it produces 2 rotations or 2 reflections, then only one as it should do, every other time.(maybe there is something wrong in my code ? )
(to enlarge the output cell, menu cell -> Current output → toggle scrolling and click on left side of the output cell)
Q2):
why this code do not work on SageCell , but works in my local server ?
precision: each time I change button then back to the other button is acting twice again !
or is there a bug in interact button ?
https://ask.sagemath.org/question/48338/interact-button-reacting-twice/
#%matplotlib notebook
#import matplotlib.pyplot as plt
#from matplotlib.animation import FuncAnimation
#import animatplot as amp
#
import numpy as np
from scipy.spatial import distance
from sage.plot.point import Point
#np.set_printoptions(linewidth=110)
""" choose side number of the 2D polygon """
var('n')
n=6
maL=[]
shiftAngle=-2*pi/(2*n)
for i in range(1,n+1) :
maL.append([cos(i*2*pi/n+shiftAngle),sin(i*2*pi/n+shiftAngle)])
#mL=[[1,1],[-1,1],[-1,-1],[1,-1]]
m=matrix(maL).transpose()
max = 1.5 # figure span
figsizeV=5
def chooseColor(colorsNumber):
if 'colorL' not in locals():
colorL=[]
for i in range(0,colorsNumber) :
colorL.append([random(),random(),random()])
#show(colorL)
D=distance.cdist(colorL, colorL, 'cityblock')
Dm=matrix(D)
DvL=[]
for v in (Dm.columns()):
DvL.append((sum(v)))
#show(DvL)
keys = range(len(DvL))
DvDict=dict(zip(DvL, keys))
#show(DvDict)
DvDictSorted={k: v for k, v in sorted(DvDict.items(), key=lambda item: item[0],reverse=True)}
#show(DvDictSorted)
colorSortedL=[]
for key,val in DvDictSorted.items():
colorSortedL.append(colorL[val])
#print (key, "=>", val)
return colorSortedL
rot=matrix(SR,[[cos(2*pi/n),-sin(2*pi/n)],[sin(2*pi/n),cos(2*pi/n)]])
#ref=matrix(SR,[[cos(2*2*pi/n),sin(2*2*pi/n)],[sin(2*2*pi/n),-cos(2*2*pi/n)]])
ref=matrix(SR,[[cos(pi),sin(pi)],[sin(pi),-cos(pi)]])
# fill up color list only if color list does not exist
try: colorSortedL
except NameError: colorSortedL = None
if colorSortedL ==None :
colorSortedL=chooseColor(2*n)
#print("https://www.youtube.com/watch?v=L5GEnUuhilw&t=204s")
#show(LatexExpr(r"\mathrm{rotation_{matrix}} = \begin{bmatrix}\cos{2\pi \over n} & -\sin{2\pi \over n} \\[8pt] \sin{2\pi \over n} & \cos{2\pi \over n}\end{bmatrix} "))
#show(LatexExpr(r"\mathrm{reflexion_{matrix}} = \left(\begin{array}{rr} \cos 2 \theta & \sin 2 \theta \\ \
# \sin 2 \theta & -\cos 2 \theta \end{array}\right)"))
#show("rotation Matrix :\t",rot)
#show("reflexion Matrix :\t",ref)
#show(maL)
#show(colorSortedL)
def getRotAndReflexionMatrix(rotAndRefSerie) :
global m
#show(rot,ref)
global rotAndReflexionMatricesL
global rotAndRefMemo
mrt=m
#show("rotAndRefMemo before:\t", rotAndRefMemo,"rotAndRefSerie :\t", rotAndRefSerie)
rotAndRefMemot=deepcopy(deepcopy(rotAndRefMemo) + deepcopy(rotAndRefSerie))
#show("rotAndRefMemo :\t", rotAndRefMemot,"rotAndRefSerie :\t", rotAndRefSerie)
rotAndReflexionMatricesL=[]
for c in rotAndRefMemot :
if c=='r' :
mrt=rot*mrt
rotAndReflexionMatricesL.append(mrt)
elif c=='t' :
mrt=ref*mrt
rotAndReflexionMatricesL.append(mrt)
elif c=='c' :
#clear
mrt=m
rotAndReflexionMatricesL=[m]
rotAndRefMemot=[ ]
else :
#clear
mrt=m
rotAndReflexionMatricesL=[ ]
rotAndRefMemot=[ ]
print("only i or r or t please")
#show("rotAndRefMemo :\t", rotAndRefMemo,"rotAndRefSerie :\t", rotAndRefSerie)
rotAndRefMemo=deepcopy(rotAndRefMemot)
return mrt
def buildMatriceFigPlots(matricesL):
figPlotsL=[]
figPlot=plot(0, ymin=-1.25, ymax=1.25)
for matrice in matricesL :
matriceL=list(matrice.transpose())
figPlot=(list_plot(matriceL,color='black',size=40,figsize=(figsizeV,figsizeV)))
for i in range(0,len(matriceL)) :
#show(matriceL[i])
figPlot+=text(str(i), matriceL[i], fontsize=50, rgbcolor=colorSortedL[i] )
figPlot+= polygon([matriceL[i],matriceL[(i+1)%n],(0,0)],fill=True, thickness=4, rgbcolor=colorSortedL[i])
figPlot += circle((0,0), 1)
#figPlot += polygon(matriceL,fill=False, thickness=4, color='orange')
figPlotsL.append(figPlot)
#for c in range(0,t.dimensions()[1]) :
#for r in range(0,t.dimensions()[0]) :
# show(r,":\t",r,":\t",t[r,c])
return figPlotsL
try: rotAndReflexionMatrix
except NameError: rotAndReflexionMatrix = None
if rotAndReflexionMatrix ==None :
rotAndReflexionMatrix=m
try: rotAndReflexionMatricesL
except NameError: rotAndReflexionMatricesL = None
if rotAndReflexionMatricesL ==None :
rotAndReflexionMatricesL=[]
try: rotAndRefMemo
except NameError: rotAndRefMemo = None
#
if rotAndRefMemo ==None :
rotAndRefMemo=[]
try: matricesFigPlotsL
except NameError: matricesFigPlotsL = None
if matricesFigPlotsL ==None :
matricesFigPlotsL=[]
animateTest=False
from IPython.core.display import display, HTML
#display(HTML("<style>.container { height:100% !important; }</style>"))
display(HTML("<style>.container { width:80% !important; }</style>"))
@interact
def _(aMap=selector(['c','r', 't'],buttons=True)):
rotAndRef=list(aMap)
#show("rotAnd Reflexion sequence: \t",rotAndRef)
global rotAndReflexionMatrix
global rotAndReflexionMatricesL
rotAndReflexionMatrix=getRotAndReflexionMatrix(rotAndRef)
#show("rotAndReflexionMatrix : \t",rotAndReflexionMatrix)
#show("rotAndReflexionMatricesL : \t",rotAndReflexionMatricesL)
# plot list of matrices
matricesFigPlotsL=buildMatriceFigPlots(rotAndReflexionMatricesL)
if animateTest :
# show animated sequence
a=animate(matricesFigPlotsL,ymin=-max,ymax=max,axes_labels=['x','y'],fontsize=14,figsize=(figsizeV,figsizeV))
a.show(delay=200,iterations=1)
else:
#only show the completed sequence at the end
if matricesFigPlotsL!=[] :
show(matricesFigPlotsL[-1])ortolljMon, 23 Mar 2020 10:36:54 +0100https://ask.sagemath.org/question/50325/Sage notebook only runs when a browser is already openhttps://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 16:38:30 +0100https://ask.sagemath.org/question/49804/Output of @interact disappears when exporting Jupyter notebook to HTMLhttps://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?JuanjoThu, 31 Oct 2019 03:37:13 +0100https://ask.sagemath.org/question/48563/Problems with AMS symbols in Sage, Jupyterhttps://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 16:42:12 +0200https://ask.sagemath.org/question/48303/interact button reacting twicehttps://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 21:16:47 +0200https://ask.sagemath.org/question/48338/Problems with AMS symbols in Sage, Jupyterhttps://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 16:39:14 +0200https://ask.sagemath.org/question/48302/Convert existing notebook to Jupyterhttps://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 14:09:40 +0200https://ask.sagemath.org/question/47140/Interact layout in Jupyter-Notebookhttps://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 23:49:30 +0200https://ask.sagemath.org/question/47120/Opening "old" Sage Notebooks in Jupyter: not UTF-8 encodedhttps://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 16:32:32 +0200https://ask.sagemath.org/question/46943/Sage Notebook crashes immediatelyhttps://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 permittedrixensoWed, 10 Apr 2019 06:57:42 +0200https://ask.sagemath.org/question/46075/add entire tab column in Jupyter notebook?https://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 08:09:25 +0100https://ask.sagemath.org/question/45048/How to configure jupyter for Sage-specific use?https://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 18:00:58 +0100https://ask.sagemath.org/question/45025/