title: IronPython invocation from C# (with SciPy) fails with ImportException: "No module named mtrand"
body: <p>I have a python library I am trying to use via IronPython (v2.7 RC1 [2.7.0.30]) invocation from C# application. The library uses NumPy and SciPy quite extensively, which <strong>does work</strong> with <a href="http://pytools.codeplex.com/wikipage?title=NumPy%20and%20SciPy%20for%20.Net" rel="nofollow noreferrer">SciPy and NumPy for .NET</a> when ran using ipy from command line like this:</p>
  
  <pre><code>ipy.exe -X:Frames file_from_lib_importing_numpy.py
  </code></pre>
  
  <p>However, when I invoke IronPython from C# using the code below, an exception is thrown:</p>
  
  <pre><code>ImportException
  "No module named mtrand"
     at Microsoft.Scripting.Runtime.LightExceptions.CheckAndThrow(Object value)
     at IronPython.Runtime.Operations.PythonOps.ImportStar(CodeContext context, String fullName, Int32 level)
     at Microsoft.Scripting.Interpreter.ActionCallInstruction3.Run(InterpretedFrame frame)
     ...
     at Microsoft.Scripting.SourceUnit.Execute(Scope scope, ErrorSink errorSink)
     at Microsoft.Scripting.Hosting.ScriptSource.Execute(ScriptScope scope)
     at Microsoft.Scripting.Hosting.ScriptEngine.ExecuteFile(String path)
     at Microsoft.Scripting.Hosting.ScriptRuntime.ExecuteFile(String path)
     at Microsoft.Scripting.Hosting.ScriptRuntime.UseFile(String path)
     ...
  </code></pre>
  
  <p>The C# code (a part of it) that invokes IronPython is as follows:</p>
  
  <pre><code>    ScriptEngine _engine;
  
      var opts = new Dictionary&lt;string, object&gt;();
      opts["Frames"] = ScriptingRuntimeHelpers.True;
      _engine = Python.CreateEngine(opts);
  
      var sp = _engine.GetSearchPaths();
      sp.Add(@"c:\Program Files\IronPython 2.7");
      sp.Add(@"c:\Program Files\IronPython 2.7\DLLs");
      sp.Add(@"c:\Program Files\IronPython 2.7\Lib");
      sp.Add(@"c:\Program Files\IronPython 2.7\Lib\site-packages");
      sp.Add(_path);
      _engine.SetSearchPaths(sp);
  
      var _runtime = _engine.Runtime;
      var scope = _runtime.ExecuteFile(Path.Combine(_path, "mytest.py"));
  </code></pre>
  
  <p>For testing purposes I am executing the following file 'mytest.py':</p>
  
  <pre><code>    import sys
      sys.path.append(r'c:\Program Files\IronPython 2.7')
      sys.path.append(r'c:\Program Files\IronPython 2.7\DLLs')
      sys.path.append(r'c:\Program Files\IronPython 2.7\Lib')
      sys.path.append(r'c:\Program Files\IronPython 2.7\Lib\site-packages')
  
      import os, os.path
      cd = os.path.dirname(__file__)
      if not cd in sys.path:
          sys.path.append(os.path.dirname(__file__))
  
      import numpy as np
      print 'OK'
  
      x = np.array([1,2])
      print x
  </code></pre>
  
  <p>Which fails on the line 12 'import numpy as np'. 
  The problem is that the file <code>__init__.py</code> in IronPython 2.7\Lib\site-packages\numpy\random\ contains the following line</p>
  
  <pre><code>from mtrand import *
  </code></pre>
  
  <p>which fails. Note that the mtrand is not a module, it is a <em>directory</em>.
  I can not think of anything else I can try to make this work, so I would very much appreciate any help from you.
  Thank you very much.</p>