Kanaries / pygwalker

PyGWalker: Turn your pandas dataframe into an interactive UI for visual analysis
https://kanaries.net/pygwalker
Apache License 2.0
11.13k stars 579 forks source link

Trying to package an exe with pygwalker included using auto2py.exe #392

Closed blazegeo closed 8 months ago

blazegeo commented 8 months ago

Describe the bug When trying to launch the output "exe" I faced the below issue ValueError: The 'pygwalker' package was not installed in a way that PackageLoader understands. From looking at the auto2py repo, it might be an issue on the pygwalker end so wanted to see there's any help to fix this. Thanks. To Reproduce Steps to reproduce the behavior (install dependencies, do this in the auto-py-to-exe UI): 1- I launched auto-py-to-exe GUI. 2- I extracted python script in py file (attached at the bottom) 3- In auto-py-to-exe GUI , I have choose "file only" then process 4- Whole process run successfully. 5- When trying to launch the output "exe" I faced the below issue Traceback (most recent call last): File "GUI.py", line 33, in html.run() File "threading.py", line 975, in run File "Statistics.py", line 250, in figures_to_html Conf_Int, DHA_Corrected, GC, Operator, QC, figs, tableau = excel(values) ^^^^^^^^^^^^^ File "Scrape.py", line 88, in excel import pygwalker as pyg File "", line 1178, in _find_and_load File "", line 1149, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "pygwalker__init.py", line 16, in File "", line 1178, in _find_and_load File "", line 1149, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "pygwalker\api\walker.py", line 6, in File "", line 1178, in _find_and_load File "", line 1149, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "pygwalker\api\pygwalker.py", line 16, in File "", line 1178, in _find_and_load File "", line 1149, in _find_and_load_unlocked File "", line 690, in _load_unlocked File "PyInstaller\loader\pyimod02_importers.py", line 419, in exec_module File "pygwalker\services\render.py", line 11, in File "jinja2\loaders.py", line 323, in init__ ValueError: The 'pygwalker' package was not installed in a way that PackageLoader understands.

Your Environment: python == 3.11.1 auto-py-to-exe==2.42.0 pyinstaller==6.3.0 pygwalker==0.4.0 Eel==0.16.0 Scrape.txt

longxiaofei commented 8 months ago

Hi, @blazegeo , This seems to be some bugs with the dependency package jinja2.

Which version is jinja2?

You can try to upgrade jinja2 to the latest version and try it.

blazegeo commented 8 months ago

Hi, @blazegeo , This seems to be some bugs with the dependency package jinja2.

Which version is jinja2?

You can try to upgrade jinja2 to the latest version and try it.

Updated to jinja2 3.1.3, still ran into the same issue. What would you advise, maybe try an older version of Jinja2?

longxiaofei commented 8 months ago

I reproduced this bug.

It may be because the static files of pygwalker were not built.

I am trying to solve it.

longxiaofei commented 8 months ago

I will submit a PR to pyinstaller to fix the packaging problem of pygwalker.

Here is a temporary solution:

  1. create a directory called extra-hooks and create new file hook-pygwalker.py
# extra-hooks/hook-pygwalker.py

from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files("pygwalker")
  1. Add new input in Manually Provide Options(auto-to-exe ui)
--additional-hooks-dir "directory path of extra-hooks"
blazegeo commented 8 months ago

Thank you for this solution, it worked!