Issues loading python 3.11 .dll/.so when trying to run a python script from a .NET 6 app hosted in a docker container #2046
Andrew-Rominger
started this conversation in
General
Replies: 1 comment 1 reply
|
I got it working by copying the entire python3.11 folder from /usr/lib to my source dir, added it to the project so it would be copied to the output dir, and referenced it directly like |
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Environment
Details
Describe what you were trying to get done.
I am trying to get a .net 6.0 app to run python scripts when running in a docker container.
My code works fine running on Windows 10 or Ubuntu on WSL, but once I build it into a container I get an exception when I call PythonEngine.Initialize()
I have triple checked that the python files get put in the right spot in my docker image
What commands did you run to trigger this issue? If you can provide a
Minimal, Complete, and Verifiable example
this will help us understand the issue.
I have set Runtime.PythonDLL to point at the .dll before calling Initialize
This works when I run the program directly on my Windows 10 pc, and through WSL after changing the path to point at the .so file in /usr/lib/python3.11/config-3.11-x86_64-linux-gnu/
I have tried both linux and windows containers and I get the same exception saying it cant load the dynamic library. I am basically brand new to using Docker so I am assuming I have made some stupid mistake, here is the dockerfile I used for Windows, basically combining some stuff from the .NET 6 example, and python example files
and for linux. I am not used to working with linux and getting python installed and moved to the image felt harder than it needed to be which means I am probably missing something.
I looked around and found some other issues about getting a python program to import .NET stuff in docker containers but didn't see anything about the otherway around.
All reactions