alive-progress: FileNotFoundError grapheme_break_property.json when built as executable with PyInstaller

Hello, I am shipping executables with PyInstaller. Even though I’ve enabled hidden import for alive-progress/alive_progress, The executable throws the following error during runtime.

  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "alive_progress/styles/exhibit.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "alive_progress/styles/internal.py", line 144, in <module>
  File "alive_progress/styles/internal.py", line 22, in __create_spinners
  File "alive_progress/animations/spinners.py", line 43, in frame_spinner_factory
  File "alive_progress/animations/spinners.py", line 43, in <genexpr>
  File "alive_progress/animations/spinners.py", line 43, in <genexpr>
  File "alive_progress/utils/cells.py", line 144, in to_cells
  File "alive_progress/utils/cells.py", line 148, in split_graphemes
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "grapheme/__init__.py", line 9, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "grapheme/api.py", line 2, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "grapheme/finder.py", line 3, in <module>
  File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
  File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
  File "PyInstaller/loader/pyimod03_importers.py", line 476, in exec_module
  File "grapheme/grapheme_property_group.py", line 97, in <module>
FileNotFoundError: [Errno 2] No such file or directory: '/tmp/_MEIr3FD7j/grapheme/data/grapheme_break_property.json'

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 1
  • Comments: 15 (7 by maintainers)

Most upvoted comments

CLI Just add grapheme data like pyinstaller -F "Hello World.py" --collect-all grapheme

U have to run this pyi-makespec --onefile start.py in terminal with ur main.py file. After that, put that line in the spec file after a block code:

a.datas += Tree("<python_path>/Lib/site-packages/grapheme/", prefix= "grapheme") a.datas += Tree("<python_path>/lib/site-packages/about-time/", prefix= "about-time")

Like that:

a = Analysis(['script.py'],
             pathex=[],
             binaries=[],
             datas=[],
             hiddenimports=[],
             hookspath=[],
             runtime_hooks=[],
             excludes=[],
             win_no_prefer_redirects=False,
             win_private_assemblies=False,
             cipher=block_cipher,
             noarchive=False)
a.datas += Tree("<python_path>/Lib/site-packages/grapheme/", prefix= "grapheme")
a.datas += Tree("<python_path>/lib/site-packages/about-time/", prefix= "about-time")

Then, run pyinstaller spec file and that’s it!

Got it working by force downgrading the version to alive_progress==1.6.2