Skip to content

Encountering dll not found exception using mono #985

Closed
@jharonfe

Description

@jharonfe

Environment

  • Pythonnet version: 2.3.0
  • Python version: 3.6.8
  • Operating System: Ubuntu 18.04.3
  • Mono: 6.4.0.198

Details

Attempting to port .NET application from windows to linux running under mono. This application has a dependency on the Python.Runtime.dll version number above.

The build of the program in the code below encounters a DLLNotFoundException.

    public static void Main(string[] args)
        {
            PythonEngine.Initialize();
            using (Py.GIL())
            {
                PythonEngine.Exec("print('hello')");
            }

            Console.WriteLine("done");
            Console.ReadLine();
        }

I've tested variations of the code above that include setting the PYTHONHOME and PATH variables. But I still encounter the same exception.

See the full exception message, stack trace below.

System.DllNotFoundException: python35 assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Python.Runtime.Runtime.Py_IsInitialized()
  at Python.Runtime.Runtime.Initialize () [0x00001] in <11c81f5f20364a28b963bcd102f70399>:0 
  at Python.Runtime.PythonEngine.Initialize (System.Collections.Generic.IEnumerable`1[T] args, System.Boolean setSysArgv) [0x0001b] in <11c81f5f20364a28b963bcd102f70399>:0 
  at Python.Runtime.PythonEngine.Initialize (System.Boolean setSysArgv) [0x00006] in <11c81f5f20364a28b963bcd102f70399>:0 
  at Python.Runtime.PythonEngine.Initialize () [0x00001] in <11c81f5f20364a28b963bcd102f70399>:0 
  at MonoPythonnet.MainClass.Main (System.String[] args) [0x00001] in /home/jon/ws/2019.11.09.test.MonoPythonnet/MonoPythonnet/Program.cs:11 
[ERROR] FATAL UNHANDLED EXCEPTION: System.DllNotFoundException: python35 assembly:<unknown assembly> type:<unknown type> member:(null)
  at (wrapper managed-to-native) Python.Runtime.Runtime.Py_IsInitialized()
  at Python.Runtime.Runtime.Initialize () [0x00001] in <11c81f5f20364a28b963bcd102f70399>:0 
  at Python.Runtime.PythonEngine.Initialize (System.Collections.Generic.IEnumerable`1[T] args, System.Boolean setSysArgv) [0x0001b] in <11c81f5f20364a28b963bcd102f70399>:0 
  at Python.Runtime.PythonEngine.Initialize (System.Boolean setSysArgv) [0x00006] in <11c81f5f20364a28b963bcd102f70399>:0 
  at Python.Runtime.PythonEngine.Initialize () [0x00001] in <11c81f5f20364a28b963bcd102f70399>:0 
  at MonoPythonnet.MainClass.Main (System.String[] args) [0x00001] in /home/jon/ws/2019.11.09.test.MonoPythonnet/MonoPythonnet/Program.cs:11 

I also have included a zip of the output of the mono execution with log level set to debug.
info.log.zip

Some help sorting through this would be greatly appreciated. Thanks.

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