NumPy and SciPy Support in IronPython 2.7

On page 434 of the English version of Professional IronPython, I talk about some much needed CPython additions to IronPython. Two of these additions are the Numerical Python (NumPy) and Scientific Python (SciPy) packages. You use these two packages in tandem to perform scientific numeric computations. In other words, a lot of people use these packages to perform heavy duty math. At the time of writing, you needed to obtain a copy of the IronClad product (discussed on page 437) to make the packages work. That’s because IronPython has trouble supporting some CPython packages.

Recently, a reader mentioned that he was having trouble obtaining a copy of the required IronClad product for IronPython 2.7. A quick search didn’t point out any potential solutions to the problem. Of course, you can always continue to use IronPython 2.6 for development purposes, but then you lose out on all the great new features in IronPython 2.7 (see IronPython 2.7 and PTVS and IronPython 2.7.1 Update). To make things a little more complicated, there is a new IronPython 2.7.3 release to consider as part of this question.

I did quite a bit of research about this issue. IronClad is definitely aware of the problem because people have been writing them about it. A second solution that entails using a product from Enthought doesn’t work because the required download is missing. I currently have e-mails in to Enthought and hope that I receive a response that I can pass along. In short, the bad news is that you can’t use NumPy and SciPy with IronPython 2.7 for now, but there should be a solution available. More than a few people have said they were able to get the Enthought solution to work—all we need is the Enthought solution to become available.

Even though the binaries are missing, I did manage to find source files at https://github.com/ilanschnell/ironpkg. The only problem is that I know nothing at all about these source files or how to build them into something you can use with .NET. The README.txt file does make it clear that these are the correct files. (Interestingly enough, I found the required egg files at http://www.enthought.com/repo/.iron/eggs/, so most of the support seems to be there.)

I have found one bit of useful information about employing this solution, you need to use it with the -X:Frames command line switch. The Enthought documentation doesn’t make this very clear and some users have encountered problems making the solution work. If you find out where we can locate the missing ironpkg-1.0.0.py file, please let me know at John@JohnMuellerBooks.com.


Breaking news update! I’ve just tried downloading the ironpkg-1.0.0.py file from Enthought and it now works as anticipated. If you need NymPy and SciPy support in IronPython 2.7, please use the Enthought solution. Make sure you follow the directions precisely, including the need to use the -X:Frames command line switch. I found that I did need to import SciPy once inside the interactive environment, rather than at the command line as suggested on the Enthought site, but that could be a problem with my system. Contact me at John@JohnMuellerBooks.com with the result of any programming you do, but as far as I can tell, this solution now works as anticipated.