MPZ related error: where to start investigations?

162 views
Skip to first unread message

Antoine Falaize

unread,
Jun 28, 2017, 6:51:34 AM6/28/17
to sympy
Hi;

We are facing a very strange MPZ related error in the development of the pyphs package. The problem is that the main developpers can not reproduce this error, and tests pass through Travis (linux) and AppVeyor (windows).

Does anyone know where to start investigations?

Thank you for your help!

A. Falaize

Isuru Fernando

unread,
Jun 28, 2017, 7:59:12 AM6/28/17
to sy...@googlegroups.com
I can reproduce with gmpy2 and sympy=1.0, but goes away if I remove gmpy2 or update to sympy master. This was fixed accidentally in https://github.com/sympy/sympy/pull/11862


Isuru Fernando.

Isuru Fernando

unread,
Jun 28, 2017, 8:03:04 AM6/28/17
to sy...@googlegroups.com
From reproduce I meant a similar error (didn't check pyphs)

from sympy import Point
import pickle
pickle.loads(pickle.dumps(Point(1.1, 2.1).evalf()))


Isuru Fernando

Aaron Meurer

unread,
Jun 28, 2017, 3:57:54 PM6/28/17
to sy...@googlegroups.com
I don't think the fix was accidental. See
https://github.com/sympy/sympy/pull/11862/commits/8a7e07992035f05780ebc33b4ffbf72d32a83069.
From the commit message, "Also modify mpf_norm to handle non-mpz input
when the mpmath gmpy backend is
used."

Your Point example doesn't fail for me in master.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "sympy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@googlegroups.com.
> Visit this group at https://groups.google.com/group/sympy.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sympy/CA%2B01voM9aDxDcb5HP8vRbj8jFpDXT3wm7KMo0RV2SqeHB7bm5w%40mail.gmail.com.
>
> For more options, visit https://groups.google.com/d/optout.

Antoine Falaize

unread,
Jun 29, 2017, 8:13:47 AM6/29/17
to sympy
Thank you for your investigations!

So, as far as I understand: this error is related to the use of the mpmath gmpy backend, and has been corrected.

But, currently, this makes a large part of pyphs unusable for a small set of platforms, and I do not understand:
(i) the reason for certain platforms to raise this error, while other won't (we never explicitely specify any backend in pyphs, and do not point any specific version of sympy);
(ii) if this fix is already merged in the current sympy master, or if it will be in a future release.

Can we do anything to help?

Isuru Fernando

unread,
Jun 29, 2017, 10:56:57 AM6/29/17
to sy...@googlegroups.com
On Thu, Jun 29, 2017 at 5:43 PM, Antoine Falaize <antoine...@gmail.com> wrote:
Thank you for your investigations!

So, as far as I understand: this error is related to the use of the mpmath gmpy backend, and has been corrected.

But, currently, this makes a large part of pyphs unusable for a small set of platforms, and I do not understand:
(i) the reason for certain platforms to raise this error, while other won't (we never explicitely specify any backend in pyphs, and do not point any specific version of sympy);

This happens when gmpy is installed only. (SymPy detects whether gmpy is installed and uses gmpy)
 
(ii) if this fix is already merged in the current sympy master, or if it will be in a future release.

This is fixed in sympy master and will be in the next release

Isuru Fernando 
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscribe@googlegroups.com.

To post to this group, send email to sy...@googlegroups.com.
Visit this group at https://groups.google.com/group/sympy.

Antoine Falaize

unread,
Jul 4, 2017, 11:34:46 AM7/4/17
to sympy
Ok, thank you for your answer.

Unfortunately, the current release candidate 1.1rc1 does not solve the problem we are facing (see this recent test).

Could this behavior be related to the second part of this commit message?
""
There is another case at the end of Float.__new__ that is attempting to do some normalization on unknown input types using mpmath.mpf(num)._mpf_, but I am unclear when that case would actually be hit, so I've added a comment and left it alone for now.
""

Can we help in a way or another?




Le jeudi 29 juin 2017 16:56:57 UTC+2, Isuru Fernando a écrit :


On Thu, Jun 29, 2017 at 5:43 PM, Antoine Falaize <antoine...@gmail.com> wrote:
Thank you for your investigations!

So, as far as I understand: this error is related to the use of the mpmath gmpy backend, and has been corrected.

But, currently, this makes a large part of pyphs unusable for a small set of platforms, and I do not understand:
(i) the reason for certain platforms to raise this error, while other won't (we never explicitely specify any backend in pyphs, and do not point any specific version of sympy);

This happens when gmpy is installed only. (SymPy detects whether gmpy is installed and uses gmpy)
 
(ii) if this fix is already merged in the current sympy master, or if it will be in a future release.

This is fixed in sympy master and will be in the next release

It seems the 1.1.rc1

 
Isuru Fernando 

Aaron Meurer

unread,
Jul 4, 2017, 7:13:55 PM7/4/17
to sy...@googlegroups.com
I see. From the traceback, it looks like there are other places that
ints/longs are being passed to mpmath. We could probably more
carefully fix this in SymPy, but it might be better to fix this
upstream in gmpy2 or mpmath. Anyway, I would be happy to have a PR
against SymPy to fix this issue (I think the same workaround should
work, wrap the value in MPZ).

Regarding the other comment, it was fixed in this pull request
https://github.com/sympy/sympy/pull/12088/files#diff-6cd5274897d73197c25bc41e9afe63e4

Aaron Meurer
> https://groups.google.com/d/msgid/sympy/7d12409c-8619-480e-8886-ac0a12e5e278%40googlegroups.com.

Aaron Meurer

unread,
Jul 4, 2017, 7:14:21 PM7/4/17
to sy...@googlegroups.com
Also please open a SymPy issue for this. If you can give a simpler way
to reproduce it that would help.

Aaron Meurer

Fabrice Silva

unread,
Jul 6, 2017, 5:04:52 PM7/6/17
to sympy

casevh

unread,
Jul 9, 2017, 1:08:03 AM7/9/17
to sympy


On Thursday, July 6, 2017 at 2:04:52 PM UTC-7, Fabrice Silva wrote:

I have committed a fix to both gmpy2 master (which will become version 2.1.0) and to the gmpy2-2.0.9 branch.

casevh 
Reply all
Reply to author
Forward
0 new messages