title: Python script runs on Pycharm but not using Iron Python on c#
body: <p>I have a script that runs without any problems using Pycharm / Spyder but when I try to run in using Iron Python on c# I get the following error: 'No module named keras.callbacks'</p>
  
  <p>Here is the code I am using to run the script:</p>
  
  <pre><code>public string PatchParameter(string parameter, int serviceid)
          {
              var engine = Python.CreateEngine(); // Extract Python language engine from their grasp
              var scope = engine.CreateScope(); // Introduce Python namespace (scope)
              var d = new Dictionary&lt;string, object&gt;
              {
                  { "serviceid", serviceid},
                  { "parameter", parameter}
              }; // Add some sample parameters. Notice that there is no need in specifically setting the object type, interpreter will do that part for us in the script properly with high probability
  
              scope.SetVariable("params", d); // This will be the name of the dictionary in python script, initialized with previously created .NET Dictionary
              ICollection&lt;string&gt; searchPaths = engine.GetSearchPaths();
              searchPaths.Add(@"D:\Projects\xxx");
              searchPaths.Add(@"C:\Users\xxx\Anaconda3");
              searchPaths.Add(@"C:\Users\xxx\Anaconda3\Library\bin");
              searchPaths.Add(@"C:\Users\xxx\Anaconda3\Scripts");
              searchPaths.Add(@"D:\Projects\SmartTrader\venv");
              searchPaths.Add(@"D:\Projects\SmartTrader\venv\Scripts");
              searchPaths.Add("..\\..");
              engine.SetSearchPaths(searchPaths);
              ScriptSource source = engine.CreateScriptSourceFromFile(@"D:\Projects\xxx\Main.py"); // Load the script
              object result = source.Execute(scope);
              parameter = scope.GetVariable&lt;string&gt;("parameter"); // To get the finally set variable 'parameter' from the python script
              return parameter;
          }
  </code></pre>
  
  <p>In the comments it was suggested to add the virtual environment to the search paths, that still did not work though.</p>
  
  <p>I also tried running it through regular CMD and it did not work as well:</p>
  
  <pre><code>C:\Users\xxx\Anaconda3&gt;python.exe D:\Projects\xxx\Main.py
  Traceback (most recent call last):
    File "D:\Projects\xxx\Main.py", line 7, in &lt;module&gt;
      import Config as cfg
    File "D:\Projects\xxx\Config.py", line 2, in &lt;module&gt;
      from keras.callbacks import EarlyStopping, ModelCheckpoint
  ModuleNotFoundError: No module named 'keras'
  </code></pre>
  
  <p>I tried adding the Anaconda paths to its search paths but it did not work.
  What am I missing?</p>
  
  <p>Thanks
  Amit</p>