[Ironpython-users] SymPy and IronPython 2.7.4

Andrew Ayre andy at britishideas.com
Mon Apr 7 12:03:07 CEST 2014


Hello,

I have embedded IronPython 2.7.4 into a .NET 4.0 C# application. I can
enter and run scripts and I also have an interactive console. It's
working great and I have no issues... until I tried to use SymPy.

I've asked for help from the SymPy people but they don't have any
experience with IronPython.

I have a subfolder called PythonLib into which I have copied the 2.7
standard libraries. Importing from these works:

========================================================
>>>import xml.dom
>>>
========================================================

So I have copied SymPy into PythonLib as well (e.g. I have
\PythonLib\sympy\__init__.py).

Here is the first issue:

========================================================
>>>import sympy

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\__init__.py",
line 32, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy
\core\__init__.py", line 8, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\expr.py",
line 7, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\evalf.py",
line 27, in <module>
  File
"C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\containers.py",
line 14, in <module>
  File
"C:\Users\Andy\Documents\ADScript\PythonLib\sympy\utilities\__init__.py", line
17, in <module>
  File
"C:\Users\Andy\Documents\ADScript\PythonLib\sympy\utilities\timeutils.py",
line 11, in <module>
  File
"C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\compatibility.py", line
110, in u
TypeError: unicode_escape_decode() takes no arguments (1 given)
========================================================

I can't find any description of what unicode_escape_decode does. It
seems to be a built-in function? In general SymPy is passing a string to
it to be decoded so it appears to make sense that the function has an
argument.

I've worked around this with the following:

========================================================
>>>import codecs
>>>def my_unicode_escape_decode(x):
...    return x
...
>>>codecs.unicode_escape_decode = my_unicode_escape_decode
========================================================

Now I get attribute errors. Here is the result of running several
imports. Can anyone please give me some pointers as to what might be the
issue? I'm thinking it is something to do with my environment or the way
I am embedded IronPython. Thanks! Andy

========================================================
>>>import sympy

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\__init__.py",
line 32, in <module>
  File
"C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\__init__.py",
line 8, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\expr.py",
line 7, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\evalf.py",
line 9, in <module>
AttributeError: 'module' object has no attribute 'mpmath'

>>>import sympy.mpmath.libmp as libmp

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\__init__.py",
line 34, in <module>
  File
"C:\Users\Andy\Documents\ADScript\PythonLib\sympy\assumptions\__init__.py",
line 2, in <module>
  File
"C:\Users\Andy\Documents\ADScript\PythonLib\sympy\assumptions\ask.py",
line 323, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\cache.py",
line 93, in wrapper
  File
"C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\function.py",
line 185, in __new__
ImportError: No module named fancysets

>>>from sympy.sets.fancysets import Naturals0

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\__init__.py",
line 32, in <module>
  File
"C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\__init__.py",
line 8, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\expr.py",
line 7, in <module>
  File "C:\Users\Andy\Documents\ADScript\PythonLib\sympy\core\evalf.py",
line 9, in <module>
AttributeError: 'module' object has no attribute 'mpmath'


>>>sys.path

['.', 'C:\\Users\\Andy\\Documents\\ADScript\\bin\\Debug\\Lib',
'C:\\Users\\Andy\\Documents\\ADScript\\bin\\Debug\\DLLs',
'C:\\Users\\Andy\\Documents\\ADScript\\bin\\Debug\\PythonLib',
'../../PythonLib']
========================================================

-- 
Andy
PGP Key ID: 0xDC1B5864


More information about the Ironpython-users mailing list