(Bug?) Issues using scipy/numpy with IronPython (VS 2012 Ultimate)

Nov 26, 2012 at 11:46 PM

I installed scipy via the instructions here: https://www.enthought.com/repo/.iron/.

If I just have the one-liner "import scipy" as my script there's no issue with F5. However, if I have the two-line script

import scipy

from scipy import stats

I get the following output:

Traceback (most recent call last):
  File "C:\src\dm\scratch\paraff\PythonPractice\PythonPractice\scratch.py", line 2, in <module>
    from scipy import stats
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\scipy\stats\__init__.py", line 7, in <module>
    from stats import *
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\scipy\stats\stats.py", line 198, in <module>
    import distributions
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\scipy\stats\distributions.py", line 12, in <module>
    from scipy.misc import comb, derivative
  File "C:\Program Files (x86)\IronPython 2.7\lib\site-packages\scipy\misc\__init__.py", line 20, in <module>
    __all__ += common.__all__
NameError: name 'common' is not defined
Press any key to continue . . .

HOWEVER, there are no issues (besides the warning about nonlin not being there) when I run without debugging (CTRL+F5).

FYI from a previous post, I did this in case it may be helpful:

PS C:\Windows\system32> ( Get-WmiObject Win32_Process -Filter "Name like '%ipy%'" ).CommandLine

"C:\Program Files (x86)\IronPython 2.7\ipy.exe" -X:Frames "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\1.0\visualstudio_py_launcher.py" "C:\src\dm\scratch\paraff\PythonPractice\PythonPractice" 60979 635f2a6f-1dd3-4ee4-b9c9-213a46957b35 --wait-on-exception --redirect-output "C:\src\dm\scratch\paraff\PythonPractice\PythonPractice\scratch.py"

I'm ok for now getting by without debugging, but any assistance would be appreciated. Thanks!

Coordinator
Nov 27, 2012 at 6:04 PM

It looks like a bug in scipy\misc\__init__.py, since they "from common import *" and then try to refer to "common". You may be able to fix it by adding "import common" on the preceding line. That said, I can't reproduce this error, so maybe IronPython makes it work somehow?

Also, could you try upgrading to PTVS 1.5? It looks from the command line you posted that you are using 1.0. With 1.5 I do not get the error, and we've definitely made SciPy specific changes since 1.0, so it may have been fixed already.

Coordinator
Dec 5, 2012 at 10:46 PM
Edited Dec 5, 2012 at 10:46 PM

 

Also pls note that current the .net numpy/scipy branch is somewhat frozen.  It has not been merged back into the main trunk.  It may never be :(.

Dec 5, 2012 at 11:07 PM

Very cool - don't know how I missed the first message but I will first upgrade to 1.5 and see how it goes from there.

Okay - just did it and no problem here. Thanks so much for your help!