Python error in Apache NiFi: Import Error: No module named Pandas

前端 未结 1 382
刺人心
刺人心 2020-12-07 04:00

I\'m new to NiFi. I\'m trying to execute a Python script using ExecuteScript processor. When I tried a simple script which has no import commands it ran fine an

相关标签:
1条回答
  • 2020-12-07 04:27

    I believe the issue is that pandas is a natively-compiled module (it is written in C) rather than being pure Python. The reason this is a problem is that due to the JSR-223 engine, the Apache NiFi ExecuteScript processor uses Jython rather than actual Python. So Python code is fine to run, but it can't depend on modules that aren't pure Python.

    The workaround is to use the ExecuteStreamCommand processor to invoke the Python script which depends on pandas via the command-line (i.e. python my_script_that_uses_pandas.py). The flowfile content will be streamed to STDIN and captured from STDOUT. Here's a related answer describing this in detail.

    0 讨论(0)
提交回复
热议问题