Building with PyInstaller
Closed this issue · 2 comments
This isn't so much an issue as an FYI which could be added to the documentation to help future users.
I have need to build a Windows executable which makes use of python-fmrest (thanks :-. I'm using PyInstaller to do this for me. All goes well with the build but when attempting to run the resulting executable the error pkg_resources.DistributionNotFound: The 'python-fmrest' distribution was not found and is required by the application
is received.
For reasons which aren't entirely clear to me PyInstaller isn't able to locate the python-rest metadata and so although it knows the module is required it doesn't correctly bundle it into the built application.
To resolve this create a new folder in your project folder (e.g. hooks
). In there create a file hook-fmrest.py
containing
from PyInstaller.utils.hooks import copy_metadata
datas = copy_metadata('python-fmrest')
Update your .spec
file to include hookspath=['.\\hooks'],
in the Analysis section at the top of the file (hookspath will most likely be there, but empty).
If you don't have a .spec
file already then when first calling pyinstaller
add --additional-hooks-dir=C:\\Path\\To\\Your\\hooks
to the command called.
Hopefully this saves future users a couple of hours of head scratching!
Thanks for reporting. I actually have a PyInstaller app where I did exactly what you described. Could have put a hint into the documentation – sorry for that.
Will leave this ticket open until I get to writing a section in the README.
Added a section to the README as per 1a9c4e8. Thank again for mentioning.