Description
When using cx_freeze to build a dash app I get the following error-
Traceback (most recent call last):
File "C:\Users\menonAbhijit\AppData\Local\Programs\Python\Python39\lib\site-packages\cx_Freeze\initscripts\__startup__.py", line 81, in run
module.run()
File "C:\Users\menonAbhijit\AppData\Local\Programs\Python\Python39\lib\site-packages\cx_Freeze\initscripts\Console.py", line 36, in run
exec(code, m.__dict__)
File "strata.py", line 1, in <module>
File "C:\Users\menonAbhijit\AppData\Local\Programs\Python\Python39\lib\site-packages\dash_core_components\__init__.py", line 6, in <module>
import dash as _dash
File "C:\Users\menonAbhijit\AppData\Local\Programs\Python\Python39\lib\site-packages\dash\__init__.py", line 5, in <module>
from .dash import Dash, no_update # noqa: F401,E402
File "C:\Users\menonAbhijit\AppData\Local\Programs\Python\Python39\lib\site-packages\dash\dash.py", line 53, in <module>
_flask_compress_version = parse_version(get_distribution("flask-compress").version)
File "C:\Users\menonAbhijit\AppData\Local\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py", line 480, in get_distribution
dist = get_provider(dist)
File "C:\Users\menonAbhijit\AppData\Local\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py", line 356, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "C:\Users\menonAbhijit\AppData\Local\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py", line 899, in require
needed = self.resolve(parse_requirements(requirements))
File "C:\Users\menonAbhijit\AppData\Local\Programs\Python\Python39\lib\site-packages\pkg_resources\__init__.py", line 785, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'flask-compress' distribution was not found and is required by the application
Here are the versions of dash and flask modules I'm using-
dash==1.19.0
dash-bootstrap-components==0.12.0
dash-core-components==1.15.0
dash-html-components==1.1.2
dash-renderer==1.9.0
dash-table==4.11.2
Flask==1.1.2
Flask-Compress==1.9.0
The issue is in this line -
Line 53 in 597dc22
I do understand why this could be a problem. When building cx_freeze imports the required packages. Hence, Flask-Compress is imported as flask_compress. While all the imports work well within the built app, when a package is verified with its name.
I dug a little deeper to see if there was any attribute being set in the package that'd help us get the version info simply by importing it into dash.py, but I couldn't find any. I have opened an issue here as well -colour-science/flask-compress#23 (comment)
Please let me know if there is any fix for the cx_freeze issue.