Bug 1832673 - Sagemath won't calculate some simple mathematical expressions.
Summary: Sagemath won't calculate some simple mathematical expressions.
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: sagemath
Version: 32
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Paulo Andrade
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-05-07 04:02 UTC by Tomoaki Sato
Modified: 2020-05-23 02:43 UTC (History)
2 users (show)

Fixed In Version: sagemath-9.0-7.fc32
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-23 02:43:53 UTC
Type: Bug


Attachments (Terms of Use)
A template file for sagemath to draw a 3D graphic (from debian buster). (15.16 KB, text/html)
2020-05-10 11:51 UTC, Tomoaki Sato
no flags Details

Description Tomoaki Sato 2020-05-07 04:02:00 UTC
Description of problem:

Sagemath won't calculate some simple mathematical expressions, returns errors.

Version-Release number of selected component (if applicable):
sagemath 9.0

How reproducible: 

Always reproducible 

Steps to Reproduce:

1. Open sagemath notebook with "sage -n ipython" in the terminal.
2. Create a new sagemath document.
3. Input the following in a cell.

var('x')
y = x * x

4. Evaluate the cell with Shift + Enter.

Actual results:

Sagemath outputs the following:

----- Beginning of the output ----

TypeError                                 Traceback (most recent call last)
/usr/lib64/python3.8/codeop.py in __call__(self, source, filename, symbol)
    134 
    135     def __call__(self, source, filename, symbol):
--> 136         codeob = compile(source, filename, symbol, self.flags, 1)
    137         for feature in _features:
    138             if codeob.co_flags & feature.compiler_flag:

TypeError: required field "type_ignores" missing from Module

---- End of the output -----

Expected results:

No errors return.

Additional info:

Comment 1 Jerry James 2020-05-07 14:50:57 UTC
See https://bugs.python.org/issue35894.

Comment 2 Jerry James 2020-05-07 14:51:38 UTC
Thanks for the bug report.  I'll try to fix it.

Comment 3 Fedora Update System 2020-05-07 20:59:13 UTC
FEDORA-2020-e9531c1353 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-e9531c1353

Comment 4 Fedora Update System 2020-05-08 04:10:16 UTC
FEDORA-2020-e9531c1353 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-e9531c1353`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-e9531c1353

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 5 Tomoaki Sato 2020-05-08 11:01:16 UTC
Unfortunately, another problem remains in sagemath-9.0-3. 

More simple, type "1+2" into a new cell, and evaluate it with Shift+Enter (it should return "3"), this error is shown: 

----- Beginning of the output ----

TypeError                                 Traceback (most recent call last)
TypeError: Interactive constructor takes at most 1 positional argument

---- End of the output -----

If you need more information, please let me know.

Thank you for your work.

Comment 6 Jerry James 2020-05-08 17:04:47 UTC
Sorry about that.  I fixed one bug and added another.  I will do new builds today.

Comment 7 Fedora Update System 2020-05-09 04:50:49 UTC
FEDORA-2020-e9531c1353 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-e9531c1353

Comment 8 Fedora Update System 2020-05-10 06:48:50 UTC
FEDORA-2020-e9531c1353 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-e9531c1353`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-e9531c1353

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Tomoaki Sato 2020-05-10 11:51:37 UTC
Created attachment 1686986 [details]
A template file for sagemath to draw a 3D graphic (from debian buster).

I think the same file exists in Sagemath system for older version of Fedora (Fedora 31, and Sagemath 8.8?). 

This is for testing only.

Comment 10 Tomoaki Sato 2020-05-10 11:58:48 UTC
Thanks a lot!  Almost perfect.

But I have found a problem left.
When I tried to draw a 3D graphic, the system returns the following error.

----- Beginning of the output ----

/usr/lib64/python3.8/site-packages/sage/repl/rich_output/display_manager.py:590: RichReprWarning: Exception in _rich_repr_ while displaying object: [Errno 2] No such file or directory: '/usr/share/sagemath/etc/threejs/threejs_template.html'
  warnings.warn( 

---- End of the output -----

In fact, there were not "threejs" directory, and "threejs_template.html" file. 
I guess the the file and the directory structure have been lost for some reason.
So, I made the directory, and put "threejs_template.html" file into it.
(This file is what I have found in another distribution, namely, debian buster.)
Then, the 3D graphic was drawn successfully.

The following is a simple example of 3D graphic from https://doc.sagemath.org/html/en/reference/plot3d/sage/plot/plot3d/base.html

----- Beginning of the sample ----

A = sphere((0,0,0), 1, color='red')]
B = dodecahedron((2, 0, 0), color='yellow')
A+B

---- End of the sample -----

Try to put this code in a cell, and evaluate.
And I also attach the "threejs_template.html"

Thanks, again.

Comment 11 Jerry James 2020-05-11 21:36:54 UTC
Yes, there appear to be several missing directories in /usr/share/sagemath/etc.  I'll work out what should be there and fire off another round of builds.  Thanks for sticking with me through all this fumbling around.

Comment 12 Fedora Update System 2020-05-12 22:59:11 UTC
FEDORA-2020-e9531c1353 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-e9531c1353

Comment 13 Fedora Update System 2020-05-13 03:55:30 UTC
FEDORA-2020-e9531c1353 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-e9531c1353`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-e9531c1353

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 14 Tomoaki Sato 2020-05-13 19:43:30 UTC
I tested  sagemath-9.0-6.

Please try the following code (complicated one, I know).

----- Beginning of the sample ----

R.<x> = PolynomialRing(QQ)
f=x^2+1
G=f.galois_group(pari_group=True)
print(G)
print(G.permutation_group().list())

---- End of the sample -----

The last line of the code generates a very long error message.

I cannot guess where the problem is.

Comment 15 Jerry James 2020-05-13 20:49:09 UTC
Hmmm, it looks like something has gone wrong in the libgap interface.  I'll see if I can figure it out.

Comment 16 Jerry James 2020-05-13 21:00:43 UTC
I think I see the problem.  If you evaluate this first:

sage.env.GAP_SO="/usr/lib64/libgap.so.0"

then everything seems to be okay.  I'll see why the build didn't set that automatically.

Comment 17 Jerry James 2020-05-13 21:11:31 UTC
Ah, because sagemath has a function that looks for libgap.so in various directories.  So if you happen to have libgap-devel installed, it works correctly, but if you don't, you get what happened in comment 14.  Honestly, the existence of libgap-devel is probably stupid, since it contains only libgap.so.  I'll have to rethink that.

Comment 18 Tomoaki Sato 2020-05-13 22:34:38 UTC
Yes, it works!

After I installed libgap-devel, I didn't need to set the environmental variable.

I will try some other examples.

Comment 19 Fedora Update System 2020-05-14 12:39:52 UTC
FEDORA-2020-e9531c1353 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-e9531c1353

Comment 20 Fedora Update System 2020-05-15 04:31:03 UTC
FEDORA-2020-e9531c1353 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-e9531c1353`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-e9531c1353

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 21 Tomoaki Sato 2020-05-17 04:26:04 UTC
I clean-installed Fedora 32, activated testing repository, and installed sagemath 9.0.7.

Everything goes well for now.

Thanks.

Comment 22 Jerry James 2020-05-18 02:43:56 UTC
I am very glad to hear that.  Thank you for testing so thoroughly.  If you have any interest in helping to maintain the Fedora sagemath package, please let me know.  We could use more eyes on this package.

Comment 23 Fedora Update System 2020-05-23 02:43:53 UTC
FEDORA-2020-e9531c1353 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.