0

https://code.google.com/p/mpmath/issues/detail?id=239

I have experienced the problem of pickling mpmath data with a python backend and trying to retrieve them with a gmp backend. This results in an error:

ValueError: invalid digits

This is in libmpf.py and it is when this is called MPZ(man, 16)

as per the link if you substitute MPZ with long it no longer gives an error. Does anyone have any insight for this. It seems this was a hack that I'm hesitant to do.

What is the best practice solution to my problem?

thank you

evan54
  • 3,585
  • 5
  • 34
  • 61

1 Answers1

0

The issue as somewhat loosely stated in the question is due to a gmpy backend vs python backend when storing complex numbers more info here:

http://docs.sympy.org/dev/modules/mpmath/setup.html

Now the default backend in ipython in my setup was "gmpy" and as per the website above in order to disable the gmpy mode by default you need to set the MPMATH_NOGMPY variable.

In linux I did from the command line

export MPMATH_NOGMPY=1

If you want this to be permenant add that line to your ~/.profile file. I'm not very experienced with environment variables though so there may be better ways to do this.

evan54
  • 3,585
  • 5
  • 34
  • 61
  • This was also reported as a sympy issue. Please see this bug report: https://github.com/sympy/sympy/issues/7457 for a detailed description and a fix. – casevh Oct 08 '14 at 22:25