Three years ago I wrote a post about my disappointment using SciPy with IronPython. A lot has changed since then, so I thought I’d write a short follow-up post.
To install NumPy and SciPy for use with IronPython, follow the instructions here. [Update: no longer available.] After installation, NumPy works as expected.
There is one small gotcha with SciPy. To use SciPy with IronPython, start ipy
with the command line argument -X:Frames
. Then you can use SciPy as you would from CPython. For example.
c:> ipy -X:Frames >>> import scipy as sp >>> sp.pi 3.141592653589793
Without the -X:Frames
option you’ll get an error when you try to import scipy
.
AttributeError: 'module' object has no attribute '_getframe'
According to this page [link rot],
The issue is that SciPy makes use of the CPython API for inspecting the current stack frame which IronPython doesn’t enable by default because of a small runtime performance hit. You can turn on this functionality by passing the command line argument “-X:Frames” to on the command line.