I am running wine in docker. Inside this container pytest is used and a library imports pythonnet 3.0.3
When running a test, the following error comes up:
RuntimeError: Failed to create a default .NET runtime, which would
have been "netfx" on this system. Either install a
compatible runtime or configure it explicitly via
`set_runtime` or the `PYTHONNET_*` environment variables
(see set_runtime_from_env).
This seemed ta have changed in the last 5 months, it worked this summer and without changes to my dockerfile or the python module versions it wont run now.
ARG PY_VERSION=3.11
# See: https://github.com/webcomics/pywine/blob/main/Dockerfile
FROM docker.io/tobix/pywine:$PY_VERSION
RUN apt-get update -y
RUN apt-get install wget
RUN wget https://raw.githubusercontent.com/Winetricks/winetricks/master/src/winetricks && \
chmod +x winetricks && \
mv winetricks /usr/local/bin
RUN winetricks -q dotnet45
WORKDIR /app
ADD ./requirements.txt requirements.txt
RUN wine python --version
RUN wine python -m pip install pytest pytest-cov
RUN wine python -m pip install -r requirements.txt
I then installed winetricks and winetricks dotnet40
(also did dotnet48
) so the framework is in
/opt/winetricks/drive_c/windows/Microsoft.NET/Runtime/v4.0.30319/
And I set PYTHONNET_RUNTIME
to multiple different values (corefx,coreclr,dotnet40
also the path and subpaths to where dotnet is installed
Hoewever, nothing worked.
When setting the env vairable, the error changes slightly:
RuntimeError: Failed to create a .NET runtime (dotnet40) using the
parameters {}.
I have read all google links I could find, asked ChatGPT/Bing with all the details and they basically gave me the Google links back.
It is suggested to set it to coreclr
- however I do not have .Net Core installed on wine
So my questions are:
- what are the runtimes called? (like 'coreclr') - what do I have to put in there as a parameter/string
- how do I get pythonnet running in wine?