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, 17 Sep 2021 01:35:47 +0200Unable to link Jupyter notebook to correct kernelhttps://ask.sagemath.org/question/59071/unable-to-link-jupyter-notebook-to-correct-kernel/A while ago I installed sage version 9.1 on my MacBook Pro running MacOS Mojave 10.14.6. That installation was from binary and was made in the MacOS Applications folder. Today I tried to install sage version 9.4, compiling from source. The install was in a subfolder of my user folder. The install seems fine, and I am able to run sage 9.4 from the command line.
Now I am trying to run 9.4 in a Jupyter notebook. After typing
./sage -n jupyter
or
./sage -n jupyterlab
in the root directory of my new installation things start well—the following banner comes up in the terminal,
┌────────────────────────────────────────────────┐
│ SageMath version 9.4, Release Date: 2021-08-22 │
│ Using Python 3.9.5. Type "help()" for help. │
└────────────────────────────────────────────────┘
Please wait while the Jupyterlab server starts...
[I 18:26:42.688 LabApp] JupyterLab extension loaded from /Users/williamorrick2/sage- 9.4/local/lib/python3.9/site-packages/jupyterlab
[I 18:26:42.688 LabApp] JupyterLab application directory is /Users/williamorrick2/sage-9.4/local/share/jupyter/lab
[I 18:26:42.694 LabApp] Serving notebooks from local directory: /Users/williamorrick2/sage-9.4
[I 18:26:42.694 LabApp] Jupyter Notebook 6.1.1 is running at:
[I 18:26:42.694 LabApp] http://localhost:8888/?token=ba7dda9e8563ac920c9dd6ae2ab402980df04273ce90c616
[I 18:26:42.694 LabApp] or http://127.0.0.1:8888/?token=ba7dda9e8563ac920c9dd6ae2ab402980df04273ce90c616
[I 18:26:42.694 LabApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 18:26:42.704 LabApp]
To access the notebook, open this file in a browser:
file:///Users/williamorrick2/Library/Jupyter/runtime/nbserver-2218-open.html
Or copy and paste one of these URLs:
http://localhost:8888/?token=ba7dda9e8563ac920c9dd6ae2ab402980df04273ce90c616
or http://127.0.0.1:8888/?token=ba7dda9e8563ac920c9dd6ae2ab402980df04273ce90c616
[I 18:26:45.498 LabApp] Build is up to date
[I 18:26:45.750 LabApp] Kernel started: 8500f3e9-4730-4c6d-8363-5686721acc8e, name: sagemath
—but when the notebook opens (either in Jupyter notebook or in Jupyterlab) the kernel is sage 9.1 rather than 9.4. Furthermore I am unable to execute any code. In the terminal, immediately following the lines quoted above, I get a bunch of messages like
> /Applications/SageMath-9.1.app/Contents/Resources/sage/local/bin/sage: line 619: /Users/williamorrick2/sage-9.4/local/bin/python2: No such file or directory
which suggest that Jupyter is running the old kernel in the Applications folder, and that it is looking for python2 under my new installation, which only contains python3.
How do I go about correcting this?Will OrrickFri, 17 Sep 2021 01:35:47 +0200https://ask.sagemath.org/question/59071/Why are there two different options for Sage in Jupyter's "New" menu?https://ask.sagemath.org/question/58818/why-are-there-two-different-options-for-sage-in-jupyters-new-menu/When I open a Jupyter Session and klick on >>New<< in the upper right corner, I get offered 3 options:
1. Python 3
2. Sage 9.3
3. SageMath 9.3
Is there any difference between the second and third alternative?
I'm on MacOS 10.15.7 (still, yes, I have reasons ...) and am using the App Version of SageMath.
dantetanteFri, 03 Sep 2021 09:26:12 +0200https://ask.sagemath.org/question/58818/How to download as LaTeX, and have output boxes renderedhttps://ask.sagemath.org/question/58626/how-to-download-as-latex-and-have-output-boxes-rendered/ I'm using the Jupyter notebook, and the "download as .tex" option works great for me.
The only problem is, I want the output to be rendered.
Inside the notebook, I have '%display latex' set, so all output is rendered in latex. However to my great surprise, when I export the worksheet into a .tex file, the output boxes revert to normal unformatted text.
Is there a way to make the latex formatting of outputs "survive" when saving it as a LaTeX document?
I'm not afraid of writing the LaTeX myself, but this workflow needs to work for exams, where time is a factor.
Thanks for your help
SageMath version 9.0, Release Date: 2020-01-01 │
│ Using Python 3.8.10.
Running Linux.
I would love to attach pictures, but apparently my "karma" is insufficient :DjakuplMon, 23 Aug 2021 11:16:15 +0200https://ask.sagemath.org/question/58626/Cannot install Sage 9.2 on macOS 10.15.7 Catalinahttps://ask.sagemath.org/question/56387/cannot-install-sage-92-on-macos-10157-catalina/I downloaded the binary sage-9.2-OSX_10.15.7_x86_64.app.dmg in order to install SageMath 9.2 as an app on my Mac running macOS 10.15.7. I already have SageMath 8.0 as an app, which I installed with no problem some time ago, but since I don't know of a better way to upgrade I am just trying to install the SageMath 9.2 app.
The download works fine and when I open the dmg and drag the app to 'Applications' the app starts copying just fine, but after a few minutes I get an error message saying 'The operation can't be completed because you don't have permission to access "SageMath-9.2".' and the process stops.
![Copying normally](https://i.imgur.com/10cquEa.png)
Copying normally
![After some minutes this happens](https://i.imgur.com/pWtIuZu.png)
After some minutes this happens
https://i.imgur.com/10cquEa.png https://i.imgur.com/pWtIuZu.png (clickable links added)
Do you have any suggestions as to why this might be happening and how to solve it?
Thank you very much!AnscariFri, 26 Mar 2021 13:36:15 +0100https://ask.sagemath.org/question/56387/More system resources for SageMathhttps://ask.sagemath.org/question/56372/more-system-resources-for-sagemath/I am using SageMath under Windows 10 with the jupyter notebook in Firefox. I have installed SageMath using the Windows installer binaries.
I wonder if there are ways to improve the performance of SageMath. I mean, using more CPU and/or RAM to conclude the computations faster.tolgaThu, 25 Mar 2021 08:14:33 +0100https://ask.sagemath.org/question/56372/How to make Sage use OpenSSL installed in /opt/local/{bin, lib,include}https://ask.sagemath.org/question/54790/how-to-make-sage-use-openssl-installed-in-optlocalbin-libinclude/MacOS Catalina 10.15.7. Seemingly no way to get Sage binary to recognize installed OpenSSL (I'm not taking about the screwed-up version of LibreSSL that MacOS is coming with now).
I have Python3{7,8,9} installed in /opt/local via Macports. OpenSSL-1.1.1i installed the same way (/opt/local). Everything works fine.
How do I get Sage to **use** the packages already installed, instead of, e.g., downloading its own copy of Python?
Barring that, what do I need to download to build Sage.app from sources, so it can link with a normal OpenSSL, and maybe use a normal Python?MouseMon, 21 Dec 2020 03:04:33 +0100https://ask.sagemath.org/question/54790/How get openssl with python 3 for macOS Sage 9.2?https://ask.sagemath.org/question/54185/how-get-openssl-with-python-3-for-macos-sage-92/I just installed the app version of Sage 9.2 under macOS Catalina (10.15.7), to replace Sage 9.1 which had been working perfectly.
Starting Sage 9.2 opens file:///Applications/SageMath-9.2.app/Contents/Resources/loading-page.html in Safari, but then it hangs. Viewing the log shows:
<code>
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 <module>
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 <module>
import ssl
File "/Applications/SageMath-9.2.app/Contents/Resources/sage/local/lib/python3.8/ssl.py", line 98, in <module>
import _ssl # if we can't import it, let the error propagate
ModuleNotFoundError: No module named '_ssl'
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 9.2, Release Date: 2020-10-24 │
│ Using Python 3.8.5. Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
Please wait while the Sage Jupyter Notebook server starts...
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).
</code>
What exactly do I do about openssl? I already have the MacPorts openssl @1.1.1h_0. My default python3 is from the Anaconda distribution, and I used the conda command to install openssl, and the Anaconda environment includes both openssl 1.1.1h and pyopenssl 19.1.0.
**QUESTION:** What more do I need to do, and how?
Is there some way that I need to install openssl into the sage environment, too, and if so, how?
Even if I take care of that, then how would I use the "sage -f python3 command": if I try to execute, e.g., "/Applications/SageMath-9.2.app/Contents/MacOS/sage --help", that tries again to start the server, but the openssl problem prevents it from opening -- which means that once I did (somehow) get the openssl requirement satisfied, I don't know how to get the command "sage -f python3" to work. Seems like a "Catch 22"!
I never had any openssl problem with Sage 9.1 (or earlier versions, either).murrayeTue, 10 Nov 2020 05:19:08 +0100https://ask.sagemath.org/question/54185/Customizing sage objects latex behaviourhttps://ask.sagemath.org/question/56055/customizing-sage-objects-latex-behaviour/I'm a recent user of Sage, and am really enjoing it. I use it through jupyter, mixing a lot of markdown/latex and computations.
After this initial period, I have one major annoyance:
In some cases it would be really nice to be able to modify the latex representation of built-in objects.
I am fully aware one can easily create functions that create the desired latex from an object, but this requires you to type this function every time the given datatype is in play which is impractical. This becomes even worse when using the %display text latex cell magic.
I have two concrete examples to show what kind of behaviour change I'm after:
1. Typeset vectors as column vectors rather than row vectors.
2. Typeset RealField numbers similar to what you would get from 1.23.str(skip_zeroes=True, truncate=True)
I have googled quite a bit but always come up short, but I am new to sage and might be missing something.
Some select elements can be configured, such as the RealField.scientific_notation method or the latex.matrix_delimiters, but wrapping or modifying the _latex_ method or something to the same effect would be much more flexible, albeit one could argue it would also be more _hacky_ ;)
Thanks for your help!Felix BlixMon, 08 Mar 2021 14:06:24 +0100https://ask.sagemath.org/question/56055/implicit_plot3d not rendering in Jupyter Labhttps://ask.sagemath.org/question/55896/implicit_plot3d-not-rendering-in-jupyter-lab/I'm unable to see any 3D plots in Jupyter Lab. I have tried forcing `viewer="threejs"` in the argument of a similar object, and have the same issue. Here's a screenshot of what it looks like: https://imgur.com/a/K8R3pZr. Any suggestions?
**Edit**: I'm running Ubuntu 20.10.
**Update**: I'm able to plot in Jupyter Notebook, so it's probably an issue with Jupyter Lab.
**Update**: forcing `viewer = "java3d"`,`viewer = "canvas3d"`, `viewer = "jsmol"` doesn't work either.
**Update**: I ran `sage -n jupyterlab` in the terminal. Everything seems to work fine until this:
`[W 2021-02-24 23:09:07.428 LabApp] Could not determine jupyterlab build status without nodejs`
`[W 2021-02-24 23:09:10.621 ServerApp] 404 GET /nbextensions/threejs/build/three.min.js (127.0.0.1) 19.83ms referer=http://localhost:8889/lab/tree/Jupyter/mcs_320/2-24.ipynb`
`[W 2021-02-24 23:09:10.624 ServerApp] 404 GET /nbextensions/threejs/examples/js/controls/OrbitControls.js (127.0.0.1) 2.01ms referer=http://localhost:8889/lab/tree/Jupyter/mcs_320/2-24.ipynb`
`[W 2021-02-24 23:09:10.686 ServerApp] 404 GET /nbextensions/threejs/examples/js/controls/OrbitControls.js (127.0.0.1) 2.08ms referer=http://localhost:8889/lab/tree/Jupyter/mcs_320/2-24.ipynb`
`[I 2021-02-24 23:09:10.815 ServerApp] Kernel started: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
`[W 2021-02-24 23:09:24.167 ServerApp] 404 GET /nbextensions/threejs/build/three.min.js (127.0.0.1) 1.86ms referer=http://localhost:8889/lab/tree/Jupyter/mcs_320/2-24.ipynb`
`[W 2021-02-24 23:09:24.170 ServerApp] 404 GET /nbextensions/threejs/examples/js/controls/OrbitControls.js (127.0.0.1) 1.88ms referer=http://localhost:8889/lab/tree/Jupyter/mcs_320/2-24.ipynb`
`[I 2021-02-24 23:10:30.056 ServerApp] Kernel shutdown: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx`
**Update**: Forcing `viewer = "tachyon"` works, but is not interactive.
**Update**: There must have been something wrong with how I installed Sage. I reinstalled using Anaconda and it works fine now.dfarmi2Wed, 24 Feb 2021 22:24:17 +0100https://ask.sagemath.org/question/55896/Python kernel seriously slower than SageMath kernelhttps://ask.sagemath.org/question/55851/python-kernel-seriously-slower-than-sagemath-kernel/Hi, I just found the Python kernel is seriously slower than the SageMath one.
This was the snippet to reproduce:
# intersection profiling with Python session
from sage.all import *
def run(num):
cube = (polytopes.cube() * 37 / 45).change_ring(QQ)
for i in range(num):
hspace = Polyhedron(ieqs=[[1/2, 1/(i+1), 0, 0]]).change_ring(QQ)
intersection = hspace.intersection(cube)
%timeit run(100)
The timing for SageMath kernel is `1 loop, best of 5: 186 ms per loop`, while that for Python is `1 loop, best of 5: 7.07 s per loop`. With this snippet I think no variable was cached. I also cprofiled a stand-alone .py file with the same lines (expect the `%timeit` line), whose timing is close to the Python kernel. Any idea what could cause this huge performance difference?
[Image which kernel to use](https://ibb.co/DYg6f7F)zhaiyuTue, 23 Feb 2021 23:40:29 +0100https://ask.sagemath.org/question/55851/kernel dies on plothttps://ask.sagemath.org/question/55774/kernel-dies-on-plot/I have a clean installation of SageMath on Windows 10:
SageMath version 9.2, Release Date: 2020-10-24. Using Python 3.7.7.
When I try to plot anything with SageMath notebook, e.g.
P = plot(sin, (0, 10))
P
the kernel dies. This happens on Firefox and Chrome.
How can this be? Many thanks.OldMortalityFri, 19 Feb 2021 21:28:01 +0100https://ask.sagemath.org/question/55774/Jupyter notebookshttps://ask.sagemath.org/question/55485/jupyter-notebooks/ Here is a capture of my screen
![image description](/upfiles/16118322862944004.png)
as you can see a huge place is lost. Is ther a way to increase tho working field in Jupyter notebooks ?CyrilleThu, 28 Jan 2021 12:12:37 +0100https://ask.sagemath.org/question/55485/show command latexhttps://ask.sagemath.org/question/54132/show-command-latex/I use sage both within the cocalc interface and the jupyter interface. The show() command behaves differently in each and I'm trying to understand. Here's an example in cocalc:
https://drive.google.com/file/d/1ZVMg5d3DMKGsXLfWcrZmBZm19yTH8G2L/view?usp=sharing
The same example in jupyter:
https://drive.google.com/file/d/1ZXaNv44HEpzSoyG6pz6I_PVKkwEd1_YH/view?usp=sharing
The in-line latex in cocalc is rendered nicely, the same latex in jupyter isn't. I've included the %display latex directive in the jupyter example, but it doesn't seem to make a difference.UncountableSetFri, 06 Nov 2020 18:05:38 +0100https://ask.sagemath.org/question/54132/To call sagemath program (jupyter notebook) from c programhttps://ask.sagemath.org/question/54161/to-call-sagemath-program-jupyter-notebook-from-c-program/Hi, Actually I am implementing an attack on cipher. For that I need some SAT computation. Since SAT computation can be done easily in SAGEMATH. So my program looks something like:
----------
1. I write some code in C
2. Then I will pass some input to SAT i.e. to SAGEMATH (jupyter notebook)
3. Take the output in C , verify
4. Again run 1,2,3 for finite number of times.
----------
I check SAGE documentation for a piece of Cython code but that worked for small example but the program gets complicated it returns some error.
Can you guide me in this way or provide me some references? Which is faster calling sage from c OR calling c from sage jupyter notebook?
Thanks for your help.SatyamSun, 08 Nov 2020 13:57:25 +0100https://ask.sagemath.org/question/54161/install sagemath into jupyter in windows 10 rather than the reversehttps://ask.sagemath.org/question/54022/install-sagemath-into-jupyter-in-windows-10-rather-than-the-reverse/ Okay, this is backwards from the usual. Sagemath failed for some odd reason and a reinstall didn't work. In the meantime, though, I've installed Anaconda, which has the Juptyer notebook, which accepts the Sagemath kernel. Is it possible to install the kernel into Jupyter, rather than the usual, in which sagemath installs jupyter? A kernel is a kernel so it seems possible but I've looked around and can't find a way. It only seems to work in Linux and I'm using Windows. cybervigilanteSun, 25 Oct 2020 06:08:59 +0100https://ask.sagemath.org/question/54022/how to move from notebook() to jupyterhttps://ask.sagemath.org/question/53463/how-to-move-from-notebook-to-jupyter/Seems that I missed a lot since I used sage the last time. I had to learn the hard way that notebook() will not work anymore in 9.1. With some hickups I managed to start jupyter using
> sage -n jupyter --ip 127.0.0.1
but the main jupyter page leaves me clueless.
It shows a listing of my sage root directory. How to configure it to look at ~/.sage (which is outside of this tree)? And, asking in advance, how to use my old notebooks? It seems that the notebook() function has changed to export something (for jupyter?), but instead it just complains about "ValueError: History is empty, cannot export". I moved my old .sage dir, the message is not related to the old content.
I didn not find suitable documentation. Where can I find a guide how to move from sageNB to jupyter and how to use it?
thanksgg@gTue, 15 Sep 2020 21:14:22 +0200https://ask.sagemath.org/question/53463/Latex (?)--Riemann tensor overflowhttps://ask.sagemath.org/question/53283/latex-riemann-tensor-overflow/While running Kerr_Schild.ipynb
- https://github.com/egourgoulhon/BHLectures/blob/master/sage/Kerr_Schild.ipynb
I get a bad output; not necessarily incorrect. I copied the TeX to a LaTeX GUI editor and it looks right.
When the last expression is evaluated it outputs TeX instead of LaTeX image. It is very long so it might just be a converter problem; that I can ignore. After the leadin the expression:
g.riemann().display()
Well I can't attach a trimmed file but I can provide a Dropbox link if needed.
The above expression was added just after the "Kerr Metric" paragraph; about line 13.
Is this my machine or LaTeX or Jupyter ?rrogersThu, 03 Sep 2020 23:45:04 +0200https://ask.sagemath.org/question/53283/Interact in Jupyterlab vs Jupyterhttps://ask.sagemath.org/question/50194/interact-in-jupyterlab-vs-jupyter/Hello, Sage community!
I find Jupyterlab to be more comfortable than Jupyter, so I installed it with
sage -pip install jupyterlab
and I execute it with
sage -n jupyterlab
Everything work well, except when I try to execute an interact, in which case, no sliders, no selection boxes, etc. appear. However, if I use Jupyter with
sage -n jupyter
the interact works well.
Here is a minimal working example:
@interact
def const(k = slider(-5,5,0.1,1,label='Constant')):
print(k)
In this particular case, I obtain in Jupyterlab just `1.00000000000000` without any controls, nor the possibility to change the value of `k`.
Can somebody explain why it is not possible to use interacts in Jupyterlab while it is possible in Jupyter?dsejasMon, 09 Mar 2020 06:09:38 +0100https://ask.sagemath.org/question/50194/nbextensions in jupyter from sagemathhttps://ask.sagemath.org/question/52272/nbextensions-in-jupyter-from-sagemath/Hello to everyone,
I am trying to install `nbextensions` for jupyter. I always run jupyter from sage with `sage -n jupyter`. I just upgraded (builr) to sage 9.1, then did `sage -pip install jupyter_contrib_nbextensions`. I got no error for that installation, but then when I launched `sage -n jupyter` I was expecting to see that extra tab for the extensions. It is not there, though.
Running on a unbutu18.04 machine.
Thanks!
JC
JCTue, 30 Jun 2020 21:16:42 +0200https://ask.sagemath.org/question/52272/How allow renaming SageMath-x.y.app to SageMath.app for sagetexhttps://ask.sagemath.org/question/51969/how-allow-renaming-sagemath-xyapp-to-sagemathapp-for-sagetex/When using the `sagetex` with LaTeX under MacTeX and the TeXShop front end, the suggested method (from the TeXShop docs) is to rename `SageMath-x.y.app` to just `SageMath.app` and then to create symlinks for the executable `sage` and for `sagetex.sty` within the Contents of the app.
That works just fine to use `sagetex` in LaTeX.
However, once the renaming is done, the app itself no longer works! Once I open the renamed SageMath.app, I get a pop-up error message "Juypyter Server failed to start...", and inspecting the log reveals:
/Applications/SageMath.app/Contents/Resources/sage/src/bin/sage: line 617: /Applications/SageMath-9.1.app/Contents/Resources/sage/local/bin/python3: No such file or directory
/Applications/SageMath.app/Contents/Resources/sage/src/bin/sage: line 617: exec: /Applications/SageMath-9.1.app/Contents/Resources/sage/local/bin/python3: cannot execute: No such file or directory
Apparently access to `python3` has been hard-coded into the `sage` executable so that it is expect to be in the file tree with root the original name `SageMath-x.y`.
Is there some workaround so that one can both use `sagetex` in the way recommended by the MacTeX/TeXShop world and still be able to use the SageMath app normally to start the Jupyter server, etc.?murrayeSun, 14 Jun 2020 16:51:53 +0200https://ask.sagemath.org/question/51969/Jupyter, Mathjax colorhttps://ask.sagemath.org/question/51903/jupyter-mathjax-color/ The following page `http://adereth.github.io/blog/2013/11/29/colorful-equations/` gives advice to add color in mathjax. But this seems not to work with Sage under Jupyter. Has some body a solution ?CyrilleThu, 11 Jun 2020 10:55:43 +0200https://ask.sagemath.org/question/51903/From Jupyter to one cell serverhttps://ask.sagemath.org/question/51705/from-jupyter-to-one-cell-server/ Hi there,
A long time ago I learned how to use the one-cell server. At that moment I was creating simple .html files for my students, so they could execute some code and learn a bit of Sage.
Nowadays this seems inefficient, instead of writing .html file it seems reasonable to write everything in a jupyter notebook. As I want to embed the files into a Moodle page, and want the cells to be executable therein, or by downloading an html file, without having Sage installed in the local machine, I thought I could try to turn each code cell of the jupyter notebook into a cell pointing to the one-cell server. Is it possible to do this efficiently? Can I somehow achieve my goal with Cocalc?
Thanks!JCTue, 02 Jun 2020 16:49:21 +0200https://ask.sagemath.org/question/51705/jupyter dochttps://ask.sagemath.org/question/51645/jupyter-doc/this is a very stupid question :
is there a documentation for the use of Jupyter in sagemath distribution ? Shortcut... customization....CyrilleSat, 30 May 2020 18:36:37 +0200https://ask.sagemath.org/question/51645/Creating slave notebookshttps://ask.sagemath.org/question/51549/creating-slave-notebooks/ I wonder if it si possible to construct a command to open a novel notebook inheriting of the properties of the main notebook an to communicate (go to a certainline of one of the two notebooks and to come back.
In such a way we could have a main notebook and each section would be a novel notebookCyrilleMon, 25 May 2020 16:36:29 +0200https://ask.sagemath.org/question/51549/Problem with Jupyter displaying a picturehttps://ask.sagemath.org/question/51492/problem-with-jupyter-displaying-a-picture/ When things goes wrong usually Jupyter open a windows to print warning. Why some times when things are fine it does the same thing?CyrilleFri, 22 May 2020 11:27:15 +0200https://ask.sagemath.org/question/51492/Problem: Jupyter (Sage) with Numba and pypyhttps://ask.sagemath.org/question/51098/problem-jupyter-sage-with-numba-and-pypy/I install it by:
pip3 install numba
How to use and import numba, pypy in sage.
I get:
ModuleNotFoundError: No module named 'numba'
when I run the following code
(from https://numba.pydata.org/numba-doc/latest/user/5minguide.html )
from numba import jit
import numpy as np
import time
x = np.arange(100).reshape(10, 10)
@jit(nopython=True)
def go_fast(a): # Function is compiled and runs in machine code
trace = 0
for i in range(a.shape[0]):
trace += np.tanh(a[i, i])
return a + trace
start = time.time()
go_fast(x)
end = time.time()
print("Elapsed (with compilation) = %s" % (end - start))
start = time.time()
go_fast(x)
end = time.time()
print("Elapsed (after compilation) = %s" % (end - start))SYLATue, 28 Apr 2020 12:39:37 +0200https://ask.sagemath.org/question/51098/How to create url/file link in jupyter/sage?https://ask.sagemath.org/question/51144/how-to-create-urlfile-link-in-jupytersage/I have file/url:
load("/home/***/MJRun.sage")
I would like to open (fast) this file/url in Jupyter in another card of Firefox. For example by one click. I use this file very often. How to do that?SYLAWed, 29 Apr 2020 15:58:57 +0200https://ask.sagemath.org/question/51144/matplotlib Animation in Jupyter notebookhttps://ask.sagemath.org/question/50195/matplotlib-animation-in-jupyter-notebook/Hi
SageMath 9.0 , Ubuntu 18.04.4 LTS
[matplotlib Animation little example](https://learndataanalysis.org/a-basic-example-how-to-create-animation-matplotlib-tutorial/)
Why does this code work well in a Sage terminal window, but does not work in a Jupyter notebook window or on the SageCell server?
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.animation import FuncAnimation
x_data = []
y_data = []
fig, ax = plt.subplots()
ax.set_xlim(0, 105)
ax.set_ylim(0, 12)
line, = ax.plot(0, 0)
def animation_frame(i):
x_data.append(i * 10)
y_data.append(i)
line.set_xdata(x_data)
line.set_ydata(y_data)
return line,
animation = FuncAnimation(fig, func=animation_frame, frames=np.arange(0, 10, 0.1), interval=10)
plt.show()ortolljMon, 09 Mar 2020 07:36:46 +0100https://ask.sagemath.org/question/50195/Can I make MathJax output centered in the notebook?https://ask.sagemath.org/question/50002/can-i-make-mathjax-output-centered-in-the-notebook/ My problem is the same one described here:
[Equations in notebook jump from centered to L aligned upon rendering](https://github.com/ipython/ipython/issues/7827)
and
[Centered equations become left aligned if displayed through the markdown display hook](https://github.com/ipython/ipython/issues/11159)
When I use @interact on something that outputs latex in the notebook, the constant jumping to the left is very annoying and distracting.
E.g.:
@interact
def myfunc(n = slider(1,10)):
P = matrix([[1,2,n], [2,2,3]])
show(P)
Is there any way I can control the MathJax rendering in the notebook? Can I perhaps set it to render in the center so I don't have to deal with the jumping?
ThankseodThu, 20 Feb 2020 13:40:07 +0100https://ask.sagemath.org/question/50002/same-origin errors for SageMath tutorial inside Jupyterlabhttps://ask.sagemath.org/question/49940/same-origin-errors-for-sagemath-tutorial-inside-jupyterlab/Summary: When I select Help for sagemath from the menu in Jupyterlab, the browser throws "`allow-same-origin`" errors in the console and eventually stops processing pages completely, showing "`math processing error`" for all formulas.
I am trying to add SageMath to our existing JupyterLab 1.2.6 installation inside a docker with an Ubuntu 18.04 image. I installed SageMath 9.0 and added SageMath to Jupyter via `jupyter kernelspec install ./local/share/jupyter/kernels/sagemath`.
Everything seems to run fine, except for the help: When I select "Sage Documentation" from the Help menu, in the Web Browser console I get `The document is sandboxed and lacks the allow-same-origin flag`. While the document seems to be working anyway, going through the doucmentation yields an error for every single formula it encounters, specifically: `Access to font at XX from origin null has been blocked by CORS policy, No Access-Control-Allow-Origin header is present on the requested resource`.
Still, it seems to be working somewhat, I think with the wrong fonts, but readable. However, at some point MathJax stops processing formulas completely and shows `Math Processing Error` for each formula.
I already tried setting allow-origin in the notebook configuration, but that did not change anything.
Anybody has a clue?wuebbelSun, 16 Feb 2020 09:53:03 +0100https://ask.sagemath.org/question/49940/