Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Encountered Bug After Using PandasAI (Agent) Inside My App and Standalone with PyInstaller #1126

Open
PVZMF opened this issue Apr 21, 2024 · 0 comments

Comments

@PVZMF
Copy link

PVZMF commented Apr 21, 2024

System Info

OS version: MacBook Pro, M1
Interpreter: 3.11.4
pandas-ai version: 2.0.32

馃悰 Describe the bug

I'm implementing an app using PyQt5. To analyze my data, I integrated PandasAI. While running the program directly, everything works fine. However, upon standalone packaging with PyInstaller, I encounter the following error:

Traceback (most recent call last):
  File "pandasai/pipelines/chat/generate_chat_pipeline.py", line 283, in run
    output = (self.code_generation_pipeline | self.code_execution_pipeline).run(
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pandasai/pipelines/pipeline.py", line 137, in run
    raise e
  File "pandasai/pipelines/pipeline.py", line 101, in run
    step_output = logic.execute(
                  ^^^^^^^^^^^^^^
  File "pandasai/pipelines/chat/code_execution.py", line 126, in execute
    code_to_run = self._retry_run_code(
                  ^^^^^^^^^^^^^^^^^^^^^
  File "pandasai/pipelines/chat/code_execution.py", line 346, in _retry_run_code
    return self.on_retry(code, e)
           ^^^^^^^^^^^^^^^^^^^^^^
  File "pandasai/pipelines/chat/generate_chat_pipeline.py", line 128, in on_code_retry
    return self.code_exec_error_pipeline.run(correction_input)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pandasai/pipelines/chat/error_correction_pipeline/error_correction_pipeline.py", line 47, in run
    return self.pipeline.run(input)
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "pandasai/pipelines/pipeline.py", line 137, in run
    raise e
  File "pandasai/pipelines/pipeline.py", line 101, in run
    step_output = logic.execute(
                  ^^^^^^^^^^^^^^
  File "pandasai/pipelines/chat/code_cleaning.py", line 91, in execute
    code_to_run = self.get_code_to_run(input, code_context)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pandasai/pipelines/chat/code_cleaning.py", line 137, in get_code_to_run
    code_to_run = self._clean_code(code, context)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pandasai/pipelines/chat/code_cleaning.py", line 481, in _clean_code
    self._extract_fix_dataframe_redeclarations(node, clean_code_lines)
  File "pandasai/pipelines/chat/code_cleaning.py", line 384, in _extract_fix_dataframe_redeclarations
    env = get_environment(self._additional_dependencies)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pandasai/helpers/optional.py", line 68, in get_environment
    **{builtin: __builtins__[builtin] for builtin in WHITELISTED_BUILTINS},
      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "pandasai/helpers/optional.py", line 68, in <dictcomp>
    **{builtin: __builtins__[builtin] for builtin in WHITELISTED_BUILTINS},
                ~~~~~~~~~~~~^^^^^^^^^
KeyError: 'help'

I'm utilizing the following code to package my program standalone:
pyinstaller --collect-all pandasai --noconsole --copy-metadata pandasai --add-data "resources:resources" --add-data "finance-db.db:." --icon="./resources/icons/logo.png" --name money-management --pat /opt/homebrew/bin/python3.11 money-management.py

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant