Skip to content

Azure AppService and System.DllNotFoundException: Could not load python311.dll with flags RTLD_NOW | RTLD_GLOBAL: python311.dll: cannot open shared object file: No such file or directory #120

Open
@dariusz-wozniak

Description

@dariusz-wozniak

Hi, I'm using Numpy 3.11.1.33 and:

When running the project locally, the project along with Numpy-related code works fine.

But, after deployment to the Azure AppService, website stopped working with error:

Unhandled exception. System.TypeInitializationException: The type initializer for 'Delegates' threw an exception.
---> System.DllNotFoundException: Could not load python311.dll with flags RTLD_NOW | RTLD_GLOBAL: python311.dll: cannot open shared object file: No such file or directory
at Python.Runtime.Platform.PosixLoader.Load(String dllToLoad)
at Python.Runtime.Runtime.Delegates.GetUnmanagedDll(String libraryName)
at Python.Runtime.Runtime.Delegates..cctor()
--- End of inner exception stack trace ---
at Python.Runtime.PythonEngine.Initialize(IEnumerable`1 args, Boolean setSysArgv, Boolean initSigs)
at Python.Runtime.PythonEngine.Initialize(Boolean setSysArgv, Boolean initSigs)
at Python.Runtime.PythonEngine.Initialize()
at Numpy.np.InstallAndImport(Boolean force)
at Numpy.np.<>c.b__531_0()
at System.Lazy`1.ViaFactory(LazyThreadSafetyMode mode)
at System.Lazy`1.ExecutionAndPublication(LazyHelper executionAndPublication, Boolean useDefaultConstructor)
at System.Lazy`1.CreateValue()
at System.Lazy`1.get_Value()
at Numpy.np.get_self()
at Numpy.np.arange(Int32 stop, Int32 step, Dtype dtype)
// ..

I'm using initialization of Python in the Program.cs before CreateHostBuilder(args).Build();:

np.arange(1);
Python.Runtime.PythonEngine.BeginAllowThreads();

Any ideas what's wrong? Is that because of installation fails? If yes, is it possible to use portable Python that is placed under application after build?

Note that targeted machine is a Linux, but the project is used locally in Windows/Linux/Mac environments.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions