Title: Unable to load shared library 'libdl.so' · Issue #1422 · pythonnet/pythonnet · GitHub
Open Graph Title: Unable to load shared library 'libdl.so' · Issue #1422 · pythonnet/pythonnet
X Title: Unable to load shared library 'libdl.so' · Issue #1422 · pythonnet/pythonnet
Description: Environment Pythonnet version:3.0.0.0 Python version:3.8.5 Operating System: Ubuntu 18.04 (Windows 10, WSL 2.0) .NET Runtime: Dotnet Core 5.0.201 Details I am trying to execute a Python file in a dotnet core program. I get the newest sou...
Open Graph Description: Environment Pythonnet version:3.0.0.0 Python version:3.8.5 Operating System: Ubuntu 18.04 (Windows 10, WSL 2.0) .NET Runtime: Dotnet Core 5.0.201 Details I am trying to execute a Python file in a d...
X Description: Environment Pythonnet version:3.0.0.0 Python version:3.8.5 Operating System: Ubuntu 18.04 (Windows 10, WSL 2.0) .NET Runtime: Dotnet Core 5.0.201 Details I am trying to execute a Python file in a d...
Opengraph URL: https://github.com/pythonnet/pythonnet/issues/1422
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Unable to load shared library 'libdl.so'","articleBody":"### Environment\r\n\r\n- Pythonnet version:3.0.0.0\r\n- Python version:3.8.5\r\n- Operating System: Ubuntu 18.04 (Windows 10, WSL 2.0)\r\n- .NET Runtime: Dotnet Core 5.0.201\r\n\r\n### Details\r\n\r\nI am trying to execute a Python file in a dotnet core program. I get the newest source code from github, and compiled it successfully as a DLL accoding the guidence. The version of the DLL is 3.0.0.0. I add this DLL as a reference of the project, and compile the project successfully. And then I use the command 'dotnet run' to execute the code. An exception occours with message: **Unhandled exception. System.TypeInitializationException: The type initializer for 'Python.Runtime.UcsMarshaler' threw an exception.**\r\n\r\n### Code\r\n\r\n#### program.cs\r\n\r\nThe exception occurs when trying to execute the line: PythonEngine.PythonHome = \"/home/leo/Anaconda3\";\r\n\r\n``` c#\r\nusing Python.Runtime;\r\nusing System;\r\nusing System.IO;\r\n\r\nnamespace PythonDotNet\r\n{\r\n class Program\r\n {\r\n static void Main(string[] args)\r\n {\r\n \r\n try\r\n {\r\n PythonEngine.PythonHome = \"/home/leo/Anaconda3\";\r\n PythonEngine.Initialize();\r\n\r\n var script = File.ReadAllText(\"t1.py\");\r\n\r\n PyDict locals = new PyDict();\r\n\r\n PythonEngine.Exec(script, null, locals.Handle);\r\n \r\n }\r\n finally\r\n {\r\n PythonEngine.Shutdown();\r\n Console.WriteLine(\"Done...\");\r\n Console.ReadKey();\r\n\r\n }\r\n\r\n }\r\n }\r\n}\r\n\r\n```\r\n#### python_dotnet.csproj\r\n``` xml\r\n\u003cProject Sdk=\"Microsoft.NET.Sdk\"\u003e\r\n\r\n \u003cPropertyGroup\u003e\r\n \u003cOutputType\u003eExe\u003c/OutputType\u003e\r\n \u003cTargetFramework\u003enet5.0\u003c/TargetFramework\u003e\r\n \u003c/PropertyGroup\u003e\r\n\r\n\u003cItemGroup\u003e\r\n \u003cReference Include=\"Python.Runtime\"\u003e\r\n \u003cHintPath\u003eref/Python.Runtime.dll\u003c/HintPath\u003e\r\n \u003c/Reference\u003e\r\n\u003c/ItemGroup\u003e\r\n\r\n \u003cItemGroup\u003e\r\n \u003cNone Update=\"t1.py\"\u003e\r\n \u003cCopyToOutputDirectory\u003ePreserveNewest\u003c/CopyToOutputDirectory\u003e\r\n \u003c/None\u003e\r\n \u003c/ItemGroup\u003e\r\n\u003c/Project\u003e\r\n\r\n```\r\n\r\n### command to run\r\n\r\n``` shell\r\ndotnet run\r\n```\r\n\r\n### Exception\r\n\r\nThe error message indicates that there is a file named 'lidbl.so'. \r\n\r\n```\r\nUnhandled exception. System.TypeInitializationException: The type initializer for 'Python.Runtime.UcsMarshaler' threw an exception.\r\n ---\u003e System.TypeInitializationException: The type initializer for 'Delegates' threw an exception.\r\n ---\u003e System.TypeInitializationException: The type initializer for 'Python.Runtime.Runtime' threw an exception.\r\n ---\u003e System.DllNotFoundException: Unable to load shared library 'libdl.so' or one of its dependencies. In order to help diagnose loading problems, consider setting the LD_DEBUG environment variable: liblibdl.so: cannot open shared object file: No such file or directory\r\n at Python.Runtime.Platform.LinuxLoader.dlerror()\r\n at Python.Runtime.Platform.LinuxLoader.ClearError() in /home/leo/project/pythonnet/src/runtime/platform/LibraryLoader.cs:line 90\r\n at Python.Runtime.Platform.LinuxLoader.GetFunction(IntPtr dllHandle, String name) in /home/leo/project/pythonnet/src/runtime/platform/LibraryLoader.cs:line 78\r\n at Python.Runtime.Runtime.GetDefaultDllName() in /home/leo/project/pythonnet/src/runtime/runtime.cs:line 42\r\n at Python.Runtime.Runtime..cctor() in /home/leo/project/pythonnet/src/runtime/runtime.cs:line 34\r\n --- End of inner exception stack trace ---\r\n at Python.Runtime.Runtime.Delegates..cctor() in /home/leo/project/pythonnet/src/runtime/runtime.cs:line 2251\r\n --- End of inner exception stack trace ---\r\n at Python.Runtime.Runtime.Delegates.get_PyUnicode_GetMax() in /home/leo/project/pythonnet/src/runtime/runtime.cs:line 2688\r\n at Python.Runtime.Runtime.PyUnicode_GetMax() in /home/leo/project/pythonnet/src/runtime/runtime.cs:line 1559\r\n at Python.Runtime.UcsMarshaler..cctor() in /home/leo/project/pythonnet/src/runtime/CustomMarshaler.cs:line 44\r\n --- End of inner exception stack trace ---\r\n at Python.Runtime.UcsMarshaler.Py3UnicodePy2StringtoPtr(String s) in /home/leo/project/pythonnet/src/runtime/CustomMarshaler.cs:line 124\r\n at Python.Runtime.PythonEngine.set_PythonHome(String value) in /home/leo/project/pythonnet/src/runtime/pythonengine.cs:line 97\r\n at PythonDotNet.Program.Main(String[] args) in /home/leo/project/python_dotnet/Program.cs:line 14\r\n```","author":{"url":"https://github.com/eightrivers","@type":"Person","name":"eightrivers"},"datePublished":"2021-03-19T13:16:26.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":6},"url":"https://github.com/1422/pythonnet/issues/1422"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:e437822d-6e18-0f95-ef9d-540ec19d37e9 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9A9C:3DC7AA:3C80E22:520E022:697083C4 |
| html-safe-nonce | d89de5182a69a247a7ae7114ee4c2f11dffc3395fa02af703a2f7a4cea8fb370 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QTlDOjNEQzdBQTozQzgwRTIyOjUyMEUwMjI6Njk3MDgzQzQiLCJ2aXNpdG9yX2lkIjoiODczMDI2NDM4MjM1MzczNjY0NCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 11337558e09106ca753b7deae32260f86e5285814f8ea1b6e289dc00cfa47ba9 |
| hovercard-subject-tag | issue:835981010 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/pythonnet/pythonnet/1422/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3b0b5efd5899bfe1f44a56b929fb6f88c14ee5f6fcc061c742f73bb475a60328/pythonnet/pythonnet/issues/1422 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3b0b5efd5899bfe1f44a56b929fb6f88c14ee5f6fcc061c742f73bb475a60328/pythonnet/pythonnet/issues/1422 |
| og:image:alt | Environment Pythonnet version:3.0.0.0 Python version:3.8.5 Operating System: Ubuntu 18.04 (Windows 10, WSL 2.0) .NET Runtime: Dotnet Core 5.0.201 Details I am trying to execute a Python file in a d... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eightrivers |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9920a62ba22d06470388e2904804fb7e5ec51c9e35f81784e9191394c74b2bd2 |
| turbo-cache-control | no-preview |
| go-import | github.com/pythonnet/pythonnet git https://github.com/pythonnet/pythonnet.git |
| octolytics-dimension-user_id | 6050430 |
| octolytics-dimension-user_login | pythonnet |
| octolytics-dimension-repository_id | 14748123 |
| octolytics-dimension-repository_nwo | pythonnet/pythonnet |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 14748123 |
| octolytics-dimension-repository_network_root_nwo | pythonnet/pythonnet |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7d6181066430cc06553c8396ca201e194ae33cb9 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width