Python exe cannot find "default-schema.json"

Hi Everyone,

I have been trying to package a script in dash using pyinstaller. The dash app is supposed to plot a plotly graph but fails in the following way:

FileNotFoundError: [Errno 2] No such file or directory: β€˜/TEMP/_MEI152202/plotly/package_data/default-schema.json’
Failed to execute script

Here is another question where this problem was solved by using another executable wrapper but I was wondering if anyone knew how to get this working in pyinstaller, it being an easy and intuitive option for making exes.

I am using python 3.4 in my virual environment.

Thanks so much!

1 Like

@Efidler12,

I wanted to do the exact same thing, and just now got it up and running.

I had to copy and paste (creating folders when necessary)

default-schema.json from <python_path>\site-packages\plotly\package_data\ to dist\<exe_name>\plotly\package_data\

and also

metadata.json from <python_path>\site-packages\dash_core_components\ to dist\<exe_name>\dash_core_components\

and

metadata.json from <python_path>\site-packages\dash_html_components\ to dist\<exe_name>\dash_html_components\

That seemed to work for me…

Hope this helps!

@kmateti

Having a similar problem. In the dist folder I have the executable named exe_name.exe. So if I understand correctly you are making a folder called exe_name in the same folders as the executable? Did you have to modify the pyinstaller command after copying those files over.

Here’s my command.
pyinstaller --onefile --paths C:\path\to\my\packages --distpath C:\my\output\path\dist --workpath C:\my\output\path\build C:\path\to\my\python\program.py

This worked on getting the app to boot successfully, but we then got Error loading layout.... I had to carry on following the error messages and copying the entirety of dash_core_components across etc.
I.e. keep copying the missing .js files across and you should get there :slight_smile:

I had a similar problem and solved by following solution.

This link helped me a lot.
https://gist.github.com/GaryLee/d191f239acf2f47bec93

I create two hook files, one for dash_html_components and the other for flask
like following:

from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('dash_html_components')
from PyInstaller.utils.hooks import collect_data_files

datas = collect_data_files('flask')

pyinstaller --onefile --additional-hooks-dir=. your_awesome.py

This solved my problem.

I used following software version:
PyInstaller: 3.4
Python: 3.6.1
and platform is Linux-4.11.0-14-generic-x86_64-with-debian-stretch-sid

Hi , how did you solve by another executable wrapper?

hi, i tried this solution but hook-graph.exe not working due to missing of plotly.min.js