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

Dependency not able to be imported in generated executable #378

Closed
idahogray opened this issue Mar 29, 2021 · 4 comments
Closed

Dependency not able to be imported in generated executable #378

idahogray opened this issue Mar 29, 2021 · 4 comments
Labels
bug Something isn't working compatibility For compatibility issues with 3rd party Python projects

Comments

@idahogray
Copy link

I am getting the following error when running the generated executable using pyoxidizer run.

Traceback (most recent call last):
File "", line 1, in
File "checksumdir", line 19, in
File "pkg_resources", line 886, in require
File "pkg_resources", line 772, in resolve
pkg_resources.DistributionNotFound: The 'checksumdir' distribution was not found and is required by the application

I am trying to package one of my applications where the dependencies are managed using poetry. One of the dependencies is checksumdir. I can see this dependency getting installed by pyoxidizer.

Successfully installed PyYAML-5.4.1 calc-to-settings-2020.3.1a1 certifi-2020.12.5 chardet-4.0.0 checksumdir-1.2.0 click-7.1.2 et-xmlfile-1.0.1 idna-2.10 openpyxl-3.0.7 requests-2.25.1 sel-api-client-2021.2.19 tabulate-0.8.9 urllib3-1.26.4

The only thing I noticed that looks odd is that checksumdir puts most of the logic in the init.py file. I am not sure if that causes a problem or not. I am happy to submit a bug report to that repo if it turns out to be an issue in that project. Any troubleshooting pointers would be greatly appreciated.

@indygreg indygreg added bug Something isn't working compatibility For compatibility issues with 3rd party Python projects labels Apr 16, 2021
@indygreg
Copy link
Owner

The run-time failure is in pkg-resources. Unfortunately, PyOxidizer doesn't have good support for the pkg_resources APIs. This is documented at https://pyoxidizer.readthedocs.io/en/stable/oxidized_importer_resource_files.html?highlight=pkg_resources#support-for-pkg-resources. So this might be a duplicate of #236.

@idahogray
Copy link
Author

Thank you, I should have paid closer attention to the error. I will try to submit a PR to the checksumdir project to see if they will try something else here.

@indygreg
Copy link
Owner

indygreg commented Apr 16, 2021 via email

@lauhayden
Copy link

lauhayden commented May 15, 2021

I just ran into this exact error today, on the unitypack package. I'm guessing by 0.14.0 release notes that this use case is supposed to be supported by now - should I open a new issue? The specific place that package uses pkg_resources is here: https://github.com/HearthSim/UnityPack/blob/f8cdc2516538d189606a76986ad2d71c3fad5f8b/unitypack/__init__.py

I will patch it out in the meantime (this is a trivial use of pkg_resources)

Python 3.9.5 (default, May  6 2021, 17:29:31) [MSC v.1928 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import unitypack
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "unitypack", line 4, in <module>
  File "pkg_resources", line 886, in require
  File "pkg_resources", line 772, in resolve
pkg_resources.DistributionNotFound: The 'unitypack' distribution was not found and is required by the application
>>> import pkg_resources
>>> pkg_resources._provider_factories
{<class 'object'>: <class 'pkg_resources.NullProvider'>, <class '_frozen_importlib_external.SourceFileLoader'>: <class 'pkg_resources.DefaultProvider'>, <class '_frozen_importlib_external.SourcelessFileLoader'>: <class 'pkg_resources.DefaultProvider'>, <class 'zipimport.zipimporter'>: <class 'pkg_resources.ZipProvider'>, <class 'OxidizedFinder'>: <class 'OxidizedPkgResourcesProvider'>}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compatibility For compatibility issues with 3rd party Python projects
Projects
None yet
Development

No branches or pull requests

3 participants