question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

mpmath creates Memory Error on import

See original GitHub issue

I wasn’t able to determine the reason, but it seems that when importing mpmath with gmp=6.2.0 it creates a Memory Error during this operation:

mpmath/mpmath/libmp/libelefun.py

# ~= next power of two + 20
cache_prec_steps = [22,22]
for k in xrange(1, bitcount(LOG_TAYLOR_PREC)+1):
cache_prec_steps += [min(2**k,LOG_TAYLOR_PREC)+20] * 2**(k-1)

When I downgraded gmp<=6.1.2.

mpmath imported successfully.

Stack trace is unavailable. If I am able to reproduce behavior I will attach.

python 3.7.6 gmpy2 2.1.0b1

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:15

github_iconTop GitHub Comments

1reaction
jjhelmuscommented, Jan 30, 2020

I can confirm that the 6.2.0 build 1 packages (conda-forge/linux-64::gmp-6.2.0-he1b5a44_1) give the expect results for the test program and the python test.

0reactions
brianmcconnelcommented, Feb 2, 2020

I can also confirm that this now works after updating to the latest version of gmp=6.2.0 gmp 6.2.0 he1b5a44_1 conda-forge

I was able to get it to work on two intel cpus: An old Intel® Xeon® CPU E5-2643 0 @ 3.30GHz And a newer Intel® Core™ i5-10210U CPU @ 1.60GHz

Thanks for the help in getting to the bottom of the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Precision and representation issues - mpmath
This section gives an overview of arbitrary-precision binary floating-point arithmetic and some concepts from numerical analysis. The following concepts are ...
Read more >
Python uses huge amount of RAM to import file - Stack Overflow
I have hit a snag when I increase the matrix size, which causes the exernal file ... from __future__ import division import mpmath...
Read more >
Out of memory on big expressions · Issue #17609 - GitHub
For some particular expressions, SymPy eats my 512 GB of RAM, and ends up crashing ... from sympy.parsing.sympy_parser import parse_expr ...
Read more >
MemoryError when importing a custom module
When I try to import the module through the UART REPL, I get the following error: Code: Select all MemoryError: memory allocation failed, ......
Read more >
Utility functions — SymPy 0.7.4.1 documentation - omz:software
from mpmath import * >>> mp.dps = 15; mp.pretty = False ... Exact addition avoids cancellation errors, enforcing familiar laws of numbers such...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found