Pandas dataframe .to_json() crashes Custom Application

brandus1
Mon, 17 Apr 2023 08:39:48 +0000
Support

Hi,

I have a custom app built with SlicerCustomAppTemplate (slicer 5.2.2).

I compiled the application on ubuntu 20.04 (docker), and a weird thing is happening.

calling .to_json() from any pandas dataframe crashes the application with “exit abnormally”

a simple example like this will crash:

import pandas as pd
import numpy as np

random_table = pd.DataFrame(np.random.rand(5, 4), columns=[‘A’, ‘B’, ‘C’, ‘D’])
random_table.to_json()
(of course after slicer.util.pip_install(‘pandas’) resolves successfully)

Note that this does not crash when being executed just with PythonSlicer, but only when the app is running (headless or not). This also does not happen on stable linux Slicer downloaded from the website.

Downgrading pandas to older versions does not solve the issue.

Not sure how to debug this. Will try a debug build, but I am not sure it will catch the error when slicer exits abnormally.

My workaround will be to push this piece of code to a python subprocess.
But if anyone has a feeling on what it might be that would be great.

Cheers

2 posts - 2 participants