Ask Your Question

Where is the source code ?

asked 2017-05-10 14:54:08 +0200

wjansen gravatar image

Hello all,

I am using SageMath-7.5.1 on a Linux platform. Sometimes I am interested in the source code for studying implementation details. When asking for documentation or source code, e.g.

R.<x>=GF(61)[] ; p=x^3 + x^2 + 59*x + 60 ; p?

then the documentation may contain a line like:


But directory "~/.sage/temp/WJ1/6067" is empty! Neither does the SageMath installation directory "/usr/lib/sagemath" (recursively searched) contain a file "". So, where is the source code?

Thanks in advance

edit retag flag offensive close merge delete


In my case, after starting sage in a linux console, the path is correctly detected:

sage: p?
Type:           Polynomial_zmod_flint
String form:    x^3 + x^2 + 59*x + 60
File:           /usr/share/sage/source/sage/rings/polynomial/polynomial_zmod_flint.pyx
Docstring:         Polynomial on ZZ/nZZ implemented via FLINT.
dan_fulea gravatar imagedan_fulea ( 2017-05-10 19:31:07 +0200 )edit

That's so in your case, not in mine.

wjansen gravatar imagewjansen ( 2017-05-11 10:32:58 +0200 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2017-05-10 15:03:52 +0200

kcrisman gravatar image

Yes, when it does that it just puts the things in a temp directory. But look for polynomial_zmod_flint.pyx. For me, when I'm in the Sage directory, it's

$ pwd
$ ls polynomial_zmod_flint.pyx 
edit flag offensive delete link more


My installation contains only one subdirectory of .../sage/src, namely doc. So it may be an installation issue. What can I do to install more subdirectories? I installed the compiled SageMath, not from source code.

BTW, I searched the installation directory for file names having two asterisks: "polynomial_zmodasterisk.pyasterisk" including the "pyx" files. Unfortunately, both asterisks were deleted in the formatted question you see (and, my failure, I did not look at it).

wjansen gravatar imagewjansen ( 2017-05-10 17:14:43 +0200 )edit

Hmm, then you might be installing it via some binary that explicitly is stripped down to make sure the size is small. Can you say precisely which SageMath you installed? Which exact binary or installation procedure? Hopefully someone else can answer once you provide that - I do not have a Linux install.

kcrisman gravatar imagekcrisman ( 2017-05-11 03:10:06 +0200 )edit

I used the installation procedure according to "", entry "Ubuntu PPA" (only the last of the three commands is relevant to find out what had been installed). The link points to version 7.6, but when I installed version 7.5.1 it was the same procedure. Well, I can try to upgrade to version 7.6 to see what happens.

Addendum 1: I did without success: "sagemath-upstream-binary" still provides version 7.5.1.

Addendum 2: Now, I installed version 7.6 from a tar.bz2 archive according to entry "Usage" in the link given above (i.e. no upgrade): the missing sources are there, hurrah! If the stripping down is really necessary to generate the PPA it may be wise to add a comment in entry "Ubuntu PPA".

wjansen gravatar imagewjansen ( 2017-05-11 10:40:48 +0200 )edit

Ah, the PPA was the culprit - as I suspected. Yes, I think we can add some info on that.

kcrisman gravatar imagekcrisman ( 2017-05-11 14:54:35 +0200 )edit
kcrisman gravatar imagekcrisman ( 2017-05-11 14:57:33 +0200 )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


Asked: 2017-05-10 14:54:08 +0200

Seen: 1,271 times

Last updated: May 10 '17