-
Notifications
You must be signed in to change notification settings - Fork 27
PyInstaller / Flask-Compress Version Issue #22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I have no experience with PyInstaller. Is there something wrong in the packaging of flask-compress that triggers this? I tried this on a fresh virtualenv and got no issue after installing from PyPI: >>> import pkg_resources
>>> pkg_resources.get_distribution('flask-compress').version
'1.9.0' |
Thanks for the quick reply! The error only happens when frozen, so it could be that PyInstaller isn't copying whatever files that pkg_resources is expecting I'll take a more in-depth look later and create a reproducible example |
This is a standalone example: KyleKing/Poetry-EdgeCaseTesting and it looks like this is separate of flask-compress. I'm not really familiar with setuptools/packaging, so I started with what could be easy fixes such as adding a static
import importlib.metadata
print(importlib.metadata.version('flask-compress')) I'll go ahead and close this issue |
Figured it out! PyInstaller has a hook for copying metadata that I needed. I'll submit this to the https://github.com/pyinstaller/pyinstaller-hooks-contrib in #102 from PyInstaller.utils.hooks import copy_metadata
datas = (copy_metadata('flask-compress')) |
When building an executable with PyInstaller for a Flask app (in particular with Plotly/Dash that requires flask), there would be an error that flask-compress couldn't be found. However, the package was present; the problem was that the
pkg_resources.get_distribution
function call couldn't recognize the versionSomeone posted a fix to monkey patch get_distribution on StackOverflow that is working for us: https://stackoverflow.com/a/64581070/3219667, but I wondered if this is something that could be fixed in flask-compress?
I'll do a little bit more research this week (I think this might be related to setuptools and flask-compress being a single file?), but I figured it was worth a shot to ask if the flask-compress developers had ever run into this issue before.
The text was updated successfully, but these errors were encountered: