[BUG] Pyodide Packages Loading Problem - Chatflow: CSV Agent with LocalAI
Describe the bug
I am encountering an issue when trying to use the CSV Agent with a LocalAI whose model is 'gpt-4-32k'. When I prompt "Hello" in the chat, it replies like this:
PythonError: Traceback (most recent call last): File "/lib/python311.zip/_pyodide/_base.py", line 571, in eval_code_async await CodeRunner( File "/lib/python311.zip/_pyodide/_base.py", line 394, in run_async coroutine = eval(self.code, globals, locals) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "", line 1, in ModuleNotFoundError: The module 'pandas' is included in the Pyodide distribution, but it is not installed. You can install it by calling: await micropip.install("pandas") in Python, or await pyodide.loadPackage("pandas") in JavaScript See
https://pyodide.org/en/stable/usage/loading-packages.html
for more details.
Is this a Flowise bug or caused by my flowise installed node_modules?
$ npm pandas --version
10.8.0
To Reproduce Steps to reproduce the behavior:
- Go to 'CSV Agent' template
- Replace the CHATOPENAI with LOCALAI (I am using a local model)
- Prompt "Hello"
- See error
Expected behavior A clear and concise description of what you expected to happen.
Flow The local AI is not publicly available.
Setup
- Installation:
npx flowise start - Flowise Version: flowise/1.8.0
- OS: Linux
- Node Version: node-v20.6.1
- Browser: Firefox
Any updates? I'm getting an error running csv-agent as well which is associated with pandas not being installed, which is rendering the following: { "statusCode": 500, "success": false, "message": "Error: nodesService.executeCustomFunction - Error running custom function: Error: ReferenceError: read_csv is not defined", "stack": {} }
Any updates? I'm getting an error running csv-agent as well which is associated with pandas not being installed, which is rendering the following: { "statusCode": 500, "success": false, "message": "Error: nodesService.executeCustomFunction - Error running custom function: Error: ReferenceError: read_csv is not defined", "stack": {} }
Hello, unfortunately I don't have any updates. Your read_csv error is related to the read csv code of the CSV agent. Just for curiosity, which model are you using?
Yes, similar to @agpaola & @WizKid1968 , I received the same error as well ModuleNotFoundError: The module 'pandas' is included in the Pyodide distribution.
I am using llama2 and llama3.1 both give same error as above
$ npm pandas --version 10.8.2
it is working locally in docker desktop but not when deploying it server.
[INFO]: [server]: Chatflow xxxxxx added into ChatflowPool
Loading pandas, numpy, python-dateutil, six, pytz
Didn't find package pandas-1.5.3-cp311-cp311-emscripten_3_1_46_wasm32.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.25.0/full/
Didn't find package numpy-1.26.1-cp311-cp311-emscripten_3_1_46_wasm32.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.25.0/full/
Didn't find package six-1.16.0-py2.py3-none-any.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.25.0/full/
Didn't find package python_dateutil-2.8.2-py2.py3-none-any.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.25.0/full/
Didn't find package pytz-2023.3-py2.py3-none-any.whl locally, attempting to load from https://cdn.jsdelivr.net/pyodide/v0.25.0/full/
Failed to load pandas, python-dateutil, numpy, six, pytz
The following error occurred while loading pandas:
fetch failed
The following error occurred while loading python-dateutil:
fetch failed
The following error occurred while loading numpy:
fetch failed
The following error occurred while loading six:
fetch failed
The following error occurred while loading pytz:
fetch failed
2024-08-27 05:32:20 [ERROR]: [server]: Error: PythonError: Traceback (most recent call last):
File "/lib/python311.zip/_pyodide/_base.py", line 573, in eval_code_async
await CodeRunner(
File "/lib/python311.zip/_pyodide/_base.py", line 393, in run_async
coroutine = eval(self.code, globals, locals)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "
I found the issue. once deployed, it cannot load the package dynamically in the server. is there a way to install it first for below as part of package.json ?
https://cdn.jsdelivr.net/pyodide/v0.25.0/full/pandas-1.5.3-cp311-cp311-emscripten_3_1_46_wasm32.whl
after reading Pyodide, it has potentially security risk of dynamically run python code in browser. It seems currently only use for CSV Agent and Airtable
Same issue on my side