we have created an Azure function in the dotnet framework(.NET6) that processes some python scripts in runtime using pythonnnet which was embedded inside Numpy(3.7.1.28) - Nuget package.
Locally everything works fine(VS 2022, Windows 10). But once deployed in azure functions (Windows Container) we are getting the following Error. Exception: Could not load file or assembly 'Python.Runtime, Version=2.5.1.0, Culture=neutral, PublicKeyToken=null'. Could not find or load a specific file. Python version is 3.7.3(embedded) But that particular Python.Runtime dll is present when inspecting in Azure Kudu.
I am also looking for suggestions regarding combining both C# and python. Few options are IronPython and pythonnet. But in our scenario, we need the use 3rd party packages like Numpy, Pandas, and Scipy for engineering calculations.
Thanks in advance.
Locally:
I have used relative path and
ScriptEngineandScriptScopeclasses:Azure Portal:
For the Azure Function App Portal deployed, I have changed the code accordingly and it worked:
Using the same
ScriptEngineandScriptScopeclasses but taken the path usingFunctionAppDirectory,