Discover this year's submissions to the Dataiku Frontrunner Awards and give kudos to your favorite use cases and success stories!READ MORE

Python recipe Excel packages

User
Level 2
Python recipe Excel packages

Hello everyone, 

I have an issue while constructing excel with python recipe.
I need to use precise packages (xlsxwriter, xlwings, openpyxl and so on) that work very well in Anaconda.But in Dataiku python recipe it's not the case.
In my mind with python recipe I could do whatever python usually does.

Ex below of a line that does not work:

XlwingsError: Your platform only supports the instantiation via xw.Book(json=...)

 Does anyone have a solution please ?

Thank you!

 

Best regards

0 Kudos
3 Replies
sergeyd
Dataiker
Dataiker

Hi @User 

You can indeed do anything you want in python recipes as far as python itself supports this. Here the question is that xlwings natively supports only Windows and Mac OS: 

https://docs.xlwings.org/en/stable/installation.html#id2

https://github.com/xlwings/xlwings/blob/e172dfba3f2216e5885892f9653c636165332973/xlwings/main.py#L49...

    @property
    def impl(self):
        if engines.active is None:
            if not (
                sys.platform.startswith("darwin") or sys.platform.startswith("win")
            ):
                raise XlwingsError(
                    "Your platform only supports the "
                    "instantiation via xw.Book(json=...)"
                )
            elif sys.platform.startswith("darwin"):
                raise XlwingsError(
                    'Make sure to have "appscript" and "psutil", '
                    "dependencies of xlwings, installed."
                )
            elif sys.platform.startswith("win"):
                raise XlwingsError(
                    'Make sure to have "pywin32", a dependency of xlwings, installed.'
                )
        return engines.active.apps.impl

That's why the error related to the platform (OS). 

User
Level 2
Author

Hello @sergeyd , 

Thank you for the answer ! 

So actually DataIku runs on a Linux system ? I supposed it was windows but from your message I understand it is not the case.. Any way to fix it ? I've many python code I wanted to apply in recipes but I cannot.

Thank you

0 Kudos
sergeyd
Dataiker
Dataiker

Hi @User

Yes, DSS is Unix-based: 

https://doc.dataiku.com/dss/latest/installation/custom/requirements.html

You will need to search online for alternatives. Something like this: 

https://stackoverflow.com/questions/68771270/xlwings-alternative-on-linux

 

0 Kudos