Skip to content
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

Difficulties with cx_Freeze and plotly.py #1199

Closed
T4rk1n opened this issue Sep 25, 2018 · 5 comments
Closed

Difficulties with cx_Freeze and plotly.py #1199

T4rk1n opened this issue Sep 25, 2018 · 5 comments
Milestone

Comments

@T4rk1n
Copy link

T4rk1n commented Sep 25, 2018

Trying to cx_Freeze a dash app, I get errors that it cannot import pkg_resources in

from pkg_resources import resource_string
.

From a google search, seems like pkg_resources is hard to include with cx_Freeze and most solutions requires editing the site-package libs that use pkg_resources. I was only able to get past the problem once I commented out the import in my local plotly install.

I think pkg_resources can be replaced with pkgutils like we use in dash to get the bundle files.
https://github.com/plotly/dash/blob/f94991be2db9a3a640ea680c2cf872611f857eb6/dash/dash.py#L453

@jonmmease
Copy link
Contributor

I'm definitely open to considering this, but I would need to understand the background a bit more. In particular, are there any situations where pkg_resources.resource_string and pkgutils.get_data don't return the same thing?

@chriddyp Do you recall any background on how plotly.py ended up using pkg_resources and dash ended up using pkgutils.

@T4rk1n
Copy link
Author

T4rk1n commented Sep 25, 2018

@jonmmease I just tested and they return the same thing, they both resolve the content by using the appropriate loader. The difference is that pkg_resources is part of setuptools whereas pkgutil is stdlib.

@chriddyp
Copy link
Member

Do you recall any background on how plotly.py ended up using pkg_resources and dash ended up using pkgutils.

I don't recall. Probably the result of google searches for both cases. They were done a few years apart from each other so I'm not surprised that they are different.

@jonmmease
Copy link
Contributor

Thanks @T4rk1n , after looking into this a bit this does seem like a pretty benign change, and if it helps with cx_Freeze compatibility I'm all for it. This is also as good a time as any as I'm about to run through a bunch of manual notebook testing for the 3.3 release. See PR in #1201. If all goes well this will be in 3.3 in a few days.

@T4rk1n
Copy link
Author

T4rk1n commented Sep 26, 2018

Thanks

@T4rk1n T4rk1n closed this as completed Sep 26, 2018
@jonmmease jonmmease added this to the v3.3.0 milestone Sep 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants