henon / Python.Included

A Python.NET based framework enabling .NET libraries to call into Python packages without depending on a local Python installation.
MIT License
313 stars 51 forks source link

How to get proper tkinter support #20

Closed katjoek closed 3 years ago

katjoek commented 3 years ago

I have some python data processing code to integrate into a C# Azure Function. I want to use Python.Included to make this work. The problem is that the python code uses matplotlib which requires tkinter, the Tk GUI library, even though the data processing is headless. I understand that tkinter is the "defacto standard" but it isn't part of the python distributions that Python.Included uses itself.

I think I've identified the files that are needed to add tkinter support. But it requires files that are not stored in the Lib directory. So, no simple wheel to unzip.

Of course I can hack it but is there a better/proper way of getting tkinter using Python.Included?

katjoek commented 3 years ago

Sorry, it's not an issue anymore for me as it appears matplotlib was only required for debugging purposes. Okay by me to close this issue.

henon commented 3 years ago

I'll answer anyway in case others have that issue.

In such a case I'd suggest using Python.Deployment nuget instead of Python.Included, which is a part of Python.Included and contains just the install routines without the embedded Python 3.7.3. You then could prepare a custom Python distribution, i.e. by manually installing all that is missing, zip that up and put it somewhere on the internet for download. Then use the DownloadInstallationSource with Python.Deployment.Installer as shown in one of the examples.

katjoek commented 3 years ago

Thanks for the tip!