Deploy an Azure Function in python that requires to load .dll libraries

Salva 1 Reputation point

Hi Everybody,

I am trying to deploy an azure function that runs on python 3.8.

The azure function uses pythonnet 2.5.2 to load some .dll libraries so we can use its functions and classes. We use the clr.AddReference() to do so.

The function runs perfectly on our windows local machine, but when deployed we get some errors. We think this is happening because python Azure functions are only hosted by linux.

We tried to use the mono runtime version so it could be run also in linux.

from pythonnet import load

However we are getting this error:

RuntimeError: Failed to create a .NET runtime (mono) using the parameters {}.

Does anyone know how to proceed with this?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,507 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,446 Reputation points

    Hi @Salva ,

    Thanks for reaching out to Q&A forum.

    I would suggest you to use the latest version of pythonnet which is 3.0.0 and use the .net core which is compatible with Linux OS as well. AS you mentioned, Azure python functions are hosted in Linux platform only. Please load the .net core in the following way,

    from pythonnet import load

    import clr

    Hope this helps!

    0 comments No comments