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.

 

Author: John

John Mueller is a freelance author and technical editor. He has writing in his blood, having produced 99 books and over 600 articles to date. The topics range from networking to artificial intelligence and from database management to heads-down programming. Some of his current books include a Web security book, discussions of how to manage big data using data science, a Windows command -line reference, and a book that shows how to build your own custom PC. His technical editing skills have helped over more than 67 authors refine the content of their manuscripts. John has provided technical editing services to both Data Based Advisor and Coast Compute magazines. He has also contributed articles to magazines such as Software Quality Connection, DevSource, InformIT, SQL Server Professional, Visual C++ Developer, Hard Core Visual Basic, asp.netPRO, Software Test and Performance, and Visual Basic Developer. Be sure to read John’s blog at http://blog.johnmuellerbooks.com/. When John isn’t working at the computer, you can find him outside in the garden, cutting wood, or generally enjoying nature. John also likes making wine and knitting. When not occupied with anything else, he makes glycerin soap and candles, which comes in handy for gift baskets. You can reach John on the Internet at John@JohnMuellerBooks.com. John is also setting up a website at http://www.johnmuellerbooks.com/. Feel free to take a look and make suggestions on how he can improve it.