Gentoo Archives: gentoo-science

From: "François Bissey" <f.r.bissey@×××××××××.nz>
To: gentoo-science@l.g.o
Subject: Re: [gentoo-science] [sage-on-gentoo]some strange problem with sympy
Date: Sun, 17 Oct 2010 21:39:37
Message-Id: 201010181039.12889.f.r.bissey@massey.ac.nz
In Reply to: [gentoo-science] [sage-on-gentoo]some strange problem with sympy by "François Bissey"
1 Hi,
2
3 I think I found the root cause of the problem. sympy's setup.py
4 has the following line:
5
6 import sympy
7
8 it is the line triggering everything. I don't know if it calls the already
9 installed system sympy or the build copy (but I could find out).
10 The matter is it is reproducible by just opening a python2.6 shell
11 and typing "import sympy" and you will get the same message.
12 Try "import mpmath" and you will get the exact same error. This is
13 because the problem comes from mpmath and in the case of sympy
14 the copy of mpmath that is shipped with it.
15
16 mpmath ships a file which will try to load sage: libintmath.py, it also
17 tries to load gmpy if it is available. I don't know if that gives rise to
18 similar problems:
19
20 import math
21 from bisect import bisect
22
23 from settings import MODE, gmpy, sage, MP_BASE, MP_ONE, MP_ZERO
24
25 So we have to look in settings.py :
26
27 gmpy = None
28 sage = None
29
30 MODE = 'python'
31 MP_BASE = long
32
33 if 'MPMATH_NOGMPY' not in os.environ:
34 try:
35 import gmpy
36 if gmpy.version() >= '1.03':
37 MODE = 'gmpy'
38 MP_BASE = gmpy.mpz
39 except:
40 pass
41
42 if 'MPMATH_NOSAGE' not in os.environ:
43 try:
44 import sage.all
45 if hasattr(sage.all.Integer, "trailing_zero_bits"):
46 sage = sage.all
47 MODE = 'sage'
48 MP_BASE = sage.Integer
49 except:
50 pass
51
52 -----------------------------
53 This is all a little bit convoluted mpmath is used by sage and now it looks
54 like mpmath can use sage.
55
56 Anyway exporting MPMATH_NOSAGE=1 in the ebuild should solve that particular
57 problem.
58
59 Francois

Replies

Subject Author
Re: [gentoo-science] [sage-on-gentoo]some strange problem with sympy Steven Trogdon <strogdon@×××××.edu>