pandarallel icon indicating copy to clipboard operation
pandarallel copied to clipboard

Exception SystemError when using cythonized library

Open LuciusV opened this issue 5 years ago • 2 comments

When I use pandarallel in cythonized .so file, I got

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "./runtest.py", line 6, in parallel_process() File "libtest.py", line 19, in libtest.parallel_process File "/home/youjin/virtualenvs/science/lib/python3.7/site-packages/pandarallel/pandarallel.py", line 462, in closure map_result, File "/home/youjin/virtualenvs/science/lib/python3.7/site-packages/pandarallel/pandarallel.py", line 396, in get_workers_result results = map_result.get() File "/usr/lib/python3.7/multiprocessing/pool.py", line 657, in get raise self._value SystemError: unknown opcode

To reproduce:

  1. Create library.py and define any function inside which uses parallel_apply on any pandas dataframe
  2. Create run.py, which imports that function from library and runs. It will run normally.
  3. cythonize -i library.py and try to run run.py - it will fail with SystemError: unknown opcode

Environment (please complete the following information):

  • OS: Linux
  • Python version 3.7.3
  • Cython version 0.29.21
  • Pandas 1.1.1
  • Pandarallel 1.5.1

Without pandarallelization, cythonized library works without exception. I am not sure its cython fault or pandarallel fault so I created reports in both projects: https://github.com/cython/cython/issues/3908

LuciusV avatar Nov 11 '20 04:11 LuciusV

There are details from cython github comments: issue is on pandarallel side https://github.com/cython/cython/issues/3908#issuecomment-725924528 Complete code sample available at my comment https://github.com/cython/cython/issues/3908#issuecomment-725902358 there

LuciusV avatar Nov 12 '20 13:11 LuciusV

Please share your thoughts is there really no hope to do something with this on pandarallel side? :(

LuciusV avatar Mar 24 '21 16:03 LuciusV