mpmath 1.0

72 views
Skip to first unread message

Fredrik Johansson

unread,
Oct 1, 2017, 10:56:16 AM10/1/17
to mpm...@googlegroups.com, sympy
Hi all,

I tagged version 1.0.0 of mpmath a couple of days ago (September 27 being the 10 year anniversary of mpmath 0.1). It can currently be downloaded from http://mpmath.org/ and from https://github.com/fredrik-johansson/mpmath/releases

However, I'm unable to update the package on PyPI (it seems both the python2 and python3 versions I have on Linux Mint are too old for the new PyPI, something about mpmath's setup.py is broken, or I'm just doing it wrong). If someone else wants to give it a shot, give me your PyPI username and I will add you as a maintainer.

The major new feature in 1.0 is code for computing inverse Laplace transforms, contributed by Kris Kuhlman. Apart from that, there are many small bugfixes; see https://github.com/fredrik-johansson/mpmath/blob/master/CHANGES

In a little while, I might post a longer entry to my blog about the history and current state of mpmath.

Fredrik

Aaron Meurer

unread,
Oct 1, 2017, 11:21:10 PM10/1/17
to mpm...@googlegroups.com, sympy
I'm glad to see mpmath hit a real version number!

What is the error message you are getting for PyPI?

I recommend using setup.py sdist to create a tarball, upload that
tarball to the GitHub releases page, and then use twine to upload the
tarball to PyPI.

Aaron Meurer
> --
> You received this message because you are subscribed to the Google Groups
> "mpmath" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mpmath+un...@googlegroups.com.
> To post to this group, send email to mpm...@googlegroups.com.
> Visit this group at https://groups.google.com/group/mpmath.
> For more options, visit https://groups.google.com/d/optout.

Fredrik Johansson

unread,
Oct 2, 2017, 12:13:37 AM10/2/17
to mpm...@googlegroups.com, sympy
On Mon, Oct 2, 2017 at 5:20 AM, Aaron Meurer <asme...@gmail.com> wrote:
I'm glad to see mpmath hit a real version number!

What is the error message you are getting for PyPI?

I recommend using setup.py sdist to create a tarball, upload that
tarball to the GitHub releases page, and then use twine to upload the
tarball to PyPI.

Aaron Meurer

$ python setup.py sdist upload
...
Creating tar archive
removing 'mpmath-1.0.0' (and everything under it)
running upload
Submitting dist/mpmath-1.0.0.tar.gz to https://pypi.python.org/pypi
Upload failed (410): Gone (This API has been deprecated and removed from legacy PyPI in favor of using the APIs available in the new PyPI.org implementation of PyPI (located at https://pypi.org/). For more information about migrating your use of this API to PyPI.org, please see https://packaging.python.org/guides/migrating-to-pypi-org/#uploading. For more information about the sunsetting of this API, please see https://mail.python.org/pipermail/distutils-sig/2017-June/030766.html)

(Similar message with python3.)

I've tried creating a ~/.pypirc with "repository: https://upload.pypi.org/legacy/" in it according to the instructions on https://packaging.python.org/guides/migrating-to-pypi-org/#uploading, but this made no difference.

With twine, I get:

$ twine upload dist/mpmath-1.0.0.tar.gz
Uploading distributions to https://upload.pypi.org/legacy/
Uploading mpmath-1.0.0.tar.gz
...
/usr/local/lib/python2.7/dist-packages/urllib3/util/ssl_.py:137: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/advanced-usage.html#ssl-warnings
  InsecurePlatformWarning
SSLError: HTTPSConnectionPool(host='upload.pypi.org', port=443): Max retries exceeded with url: /legacy/ (Caused by SSLError(SSLError(1, '_ssl.c:510: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error'),))

Fredrik

Aaron Meurer

unread,
Oct 2, 2017, 12:31:05 AM10/2/17
to mpm...@googlegroups.com, sympy
Does twine upload work without the .pypirc? I suppose also make sure twine and setuptools are up to date. 

Aaron Meurer 

--

Fredrik Johansson

unread,
Oct 2, 2017, 12:40:53 AM10/2/17
to mpm...@googlegroups.com, sympy
On Mon, Oct 2, 2017 at 6:30 AM, Aaron Meurer <asme...@gmail.com> wrote:
Does twine upload work without the .pypirc? I suppose also make sure twine and setuptools are up to date. 


It makes no difference. I think the Python versions in my distro (Mint) are just too old (python2 2.7.6 and python3 3.4.3). I'm not keen to forcibly upgrade them since that could cause unpredictable system breakage.

Fredrik

Aaron Meurer

unread,
Oct 2, 2017, 1:30:38 AM10/2/17
to mpm...@googlegroups.com, sympy
That sounds probable. I know a lot of the point releases to python fix SSL issues. Maybe try using a miniconda python install. 

Aaron Meurer 


--

Fredrik Johansson

unread,
Oct 2, 2017, 5:04:04 AM10/2/17
to mpm...@googlegroups.com, sympy
On Mon, Oct 2, 2017 at 7:30 AM, Aaron Meurer <asme...@gmail.com> wrote:
That sounds probable. I know a lot of the point releases to python fix SSL issues. Maybe try using a miniconda python install. 



I installed 3.6 and that did the trick. https://pypi.python.org/pypi/mpmath now has the latest version.

Fredrik

Fredrik Johansson

unread,
Oct 2, 2017, 8:26:57 AM10/2/17
to mpm...@googlegroups.com, sympy
Fredrik

Aaron Meurer

unread,
Oct 2, 2017, 3:11:06 PM10/2/17
to mpm...@googlegroups.com, sympy
That's a great blog post Fredrik. Since your blog doesn't seem to have
a comments box, I will add my comments here.

One thing I would add to the mpmath history is the SymPy 1.0 release
(March 2016), which officially made mpmath an external dependency of
SymPy. Prior to that, a copy of mpmath shipped as sympy.mpmath.

I've been using mpmath (via SymPy) myself quite a bit in my own recent
research (computing the CRAM approximation to exp(-t) on [0, oo) to
arbitrary precision). I'm always amazed at how stable mpmath is. It
always gives what seem to be correct answers, or fails nicely if it
can't. While I did find some minor holes in mpmath (I had to tweak the
maxsteps and tol parameters of findroot (via sympy.nsolve), see
https://github.com/fredrik-johansson/mpmath/issues/339), it was quite
easy to work around it.

Regarding Arb, I would love to see Python bindings. I would suggest
writing some ArbPy wrapper library, so that people can use it in
Python on its own, and then we can use that to improve mpmath and
SymPy. There's been some interest in using something like Arb for code
generation. The idea is this: you can use SymPy to create a model for
something, and then use the codegen module to generate fast machine
code to compute it. But the problem is that you don't necessarily know
how precise that machine code is. What if there are numerical issues
that lead to highly inaccurate results? So the idea is to swap out the
backend for the code generator to something like Arb, and perform the
same computation with guaranteed bounds. This will obviously be slower
than the machine code, so you wouldn't use it in practice, but instead
you'd use it to get some assurance on the accuracy of your results
with machine floats. If the accuracy is bad, you might have to look
into modifying the algorithm. Or in the worst case, you just have to
use a slower arbitrary precision library to get the precision you
need. But critically, since everything is code generated, the whole
thing would (in theory at least) be as simple as changing some flag in
the code generator.

Aaron Meurer

Fredrik Johansson

unread,
Oct 2, 2017, 3:30:28 PM10/2/17
to mpm...@googlegroups.com, sympy
On Mon, Oct 2, 2017 at 9:10 PM, Aaron Meurer <asme...@gmail.com> wrote:
That's a great blog post Fredrik. Since your blog doesn't seem to have
a comments box, I will add my comments here.

Thanks!


One thing I would add to the mpmath history is the SymPy 1.0 release
(March 2016), which officially made mpmath an external dependency of
SymPy. Prior to that, a copy of mpmath shipped as sympy.mpmath.


Good point. I've shamelessly copied this into the post.
As I wrote in the post, python-flint (https://github.com/fredrik-johansson/python-flint) already exists:

>>> from flint import arb, good
>>> arb(3).sqrt()
[1.73205080756888 +/- 3.03e-15]
>>> good(lambda: arb(1) + arb("1e-1000") - arb(1), maxprec=10000)
[1.00000000000000e-1000 +/- 3e-1019]

It still needs work with the setup code, documentation, tests, general code cleanup, and interface tweaks... volunteers are welcome.

Fredrik

Aaron Meurer

unread,
Oct 2, 2017, 3:35:33 PM10/2/17
to mpm...@googlegroups.com, sympy
Thanks. It wasn't clear to me that python-flint also wraps Arb.

I think getting FLINT and python-flint on conda-forge would help a
lot, as it would make it much easier for most people to install it.

Aaron Meurer

Aaron Meurer

unread,
Oct 2, 2017, 3:42:47 PM10/2/17
to sy...@googlegroups.com, mpm...@googlegroups.com
I didn't see FLINT when I searched the feedstocks
https://github.com/conda-forge?utf8=%E2%9C%93&q=flint&type=&language=

Aaron Meurer

On Mon, Oct 2, 2017 at 3:37 PM, Isuru Fernando <isu...@gmail.com> wrote:
>> I think getting FLINT and python-flint on conda-forge would help a
>> lot, as it would make it much easier for most people to install it.
>
>
> FLINT and Arb are both on conda-forge for Linux and OSX. (For windows, I'm
> waiting for the next flint release). You just need to package `python-flint`
>
>
> Isuru Fernando
>
> --
> 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%2B01voPwcr%2BcDDgWNTutT04Afaz-VxmtrebgBVQuBPYgW-dAbQ%40mail.gmail.com.

Rudi Gaelzer

unread,
Apr 7, 2018, 7:47:36 PM4/7/18
to mpmath
Any of you know who is responsible for providing the rpm package for Fedora linux?
I'm using Fedora 27 and they are still only providing version 0.19.
Reply all
Reply to author
Forward
0 new messages