Bokeh 2.0.0 and PyInstaller

I am unable to successfully create a pyinstaller executable with bokeh==2.0.0, I get the following error:
FileNotFoundError: [Errno 2] No such file or directory: '/var/folders/w9/59qs933d4dq1j2214v_dz1sr0000gn/T/_MEI8f9v8X/bokeh/_sri.json'

All else the same, no issues with bokeh==1.4.0. Perhaps the hook needs an update? Any ideas?

I’m on macOS 10.14.6
Python 3.6
PyInstaller-4.0.dev0+96897fc78d

_sri.json is a new file that must be present in the package. Most likely the PyInstaller configuration or manifest will need to be updated, but that’s the beginning and end of my pyinstaller knowledge.

Thanks Bryan, I’ll pass this along to the PyInstaller community!

1 Like

And this is good to know. I was planning to split up the single big _sri.json file into separate files for every release but it seems like that would impose a pretty unpleasant burden for the installer maintainers unless theres is some way to specify patterns for including in the manifest

I’ve posted over on the PyInstaller google user’s group, but it’s my first post and it’s moderated… so it’s not showing up yet.

BUT I was able to get PyInstaller to work. PyInstaller comes with a bunch of preset “hooks” which are basically extra instructions per library. I went to site-packages/PyInstaller/hooks/hook-bokeh.py which is the following for the latest PyInstaller dev:

from PyInstaller.utils.hooks import collect_data_files

# core/_templates/*
# server/static/**/*
# subcommands/*.py

datas = collect_data_files('bokeh.core') + \
        collect_data_files('bokeh.server') + \
        collect_data_files('bokeh.command.subcommands', include_py_files=True)

I simply changed to:

datas = collect_data_files('bokeh.core') + \
        collect_data_files('bokeh.server') + \
        collect_data_files('bokeh.command.subcommands', include_py_files=True) + \
        collect_data_files('bokeh')

There might an easier way (or more efficient / light-weight?). But at least it works. I’m pretty sure I could add collect_data_files('bokeh') somewhere in my .spec file instead, but I’m fairly new to PyInstaller.

Also, my guess is that splitting up _sri.json into multiple files would not cause issues with this fix. I now have a feeling this sort of debugging is par for the course for PyInstaller users.

1 Like

I’ve submitted a PyInstaller pull-request which has just been merged into their develop branch: bokeh==2.0.0 requires bokeh/_sri.json by cutright · Pull Request #4746 · pyinstaller/pyinstaller · GitHub

With this change, breaking _sri.json into multiple files shouldn’t cause any issues since it tells PyInstaller to include all files in the top-level bokeh directory.

1 Like