Since I last wrote about NumPy and SciPy support in IronPython (see the NumPy and SciPy Support in IronPython 2.7 post), I’ve received some additional e-mails from readers on the topic. It turns out that there are some twists and turns to this support issue. Some readers have noted that the use of ironpkg-1.0.0.py file from Enthought actually causes problems with the Visual Studio IDE. You may very well see an assertion error. The error shows up when you attempt to type clr.AddReference(. As soon as you type the (, the IDE displays the assertion error. I haven’t personally experienced the error, but you can find discussions of it at http://pytools.codeplex.com/discussions/349615 and http://pytools.codeplex.com/workitem/656 (amongst other locations).
The issue is that the NumPy and SciPy support is strongly compiled to use a specific version of the IronPython libraries. In fact, a few authors have gone on to suggest that you use the version of IronPython supplied by Enthought, which seems like a good idea to me. I’m using IronPython 2.7.3 downloaded directly from the Codeplex site without any problem. For the time being, I’ll continue to use this version for your support questions so that I can provide the best possible information. If you encounter problems using this version, you may have to download the Enthought-specific version of IronPython to ensure NumPy and SciPy support works (or go without these libraries).
Simply installing the Enthought version of IronPython won’t be enough to fix the problem, unfortunately. You must remove the NumPy and SciPy library files completely using the ironpkg –remove command (specifically ironpkg scipy –remove in this case). You must then uninstall the copy
of IronPython that caused the error, which includes physically removing
the folder that contains the IronPython files. After you remove everything, restart Visual Studio to ensure that your IDE is working properly. Then you can install the Enthought version of IronPython and reinstall the NumPy and SciPy libraries. Following this procedure should fix the assertion error if you’re experiencing it.
I’ve been told that there will eventually be a fix for this problem, but when you think about it, the fix can’t be complete using the current programming strategy because you’re relying on low level routines to perform a specific task. Remember that you must start your application using the -X:Frames switch or you’ll most definitely run into problems. Let me know if you encounter any other issues with this particular issue at John@JohnMuellerBooks.com.