indygreg/PyOxidizer

PyOxidizer Hangs when Handling Text Encoding (SentenceTransformers)

bm777 opened this issue ยท 8 comments

Issue Summary

@indygreg
I am experiencing difficulties with PyOxidizer while generating an executable for my Python project. Specifically, the process seems to get stuck during text encoding, and I suspect it may be related to the loading of "file". (I wrote a python script to verify every file in the sentence-transformers libraries, it doesn't contains file string) Because all libraries like numpy, huggingface-cli work well in the bundle.

Steps to Reproduce

  • installed rustup and pyoxidizer
  • Create a pyoxidizer project and add some Numpy, SentenceTransformers, other libraries
  • make_exe content:
def make_exe():
   dist = default_python_distribution()

   dependencies = ["-r", "requirements.txt"]

   policy = dist.make_python_packaging_policy()
   policy.resources_location_fallback = "filesystem-relative:lib"
   python_config = dist.make_python_interpreter_config()
   python_config.config_profile = "python"
   python_config.run_module = "main"
   

   exe = dist.to_python_executable(
       name="oxid",
       packaging_policy=policy,
       config=python_config,
   )

   for resource in exe.pip_install(dependencies):
       resource.add_location = "filesystem-relative:lib"
       exe.add_python_resource(resource)

   exe.add_python_resources(exe.read_package_root(
       path="/path/to/the/app",
       packages=["main", "app"],
   ))

   return exe

Expected Behavior

I want the app to encode the text using the sentenceTransformers lib, that I successfully loaded in the lib close to the exec.

Actual Behavior

When it comes to encode the text, it stuck it do nothing. I detected that by ainserting a simple print before and after the line. And it never reach the after-print.

Environment Information

  • PyOxidizer version: 0.24.0
  • Python version: 3.10
  • Operating System: MacBook pro - OS X 14 and M2 chip

Issue solved. closing to not make it stale.

@bm777 how was your issue resolved, trying something similar but not success so far

Are you also using library like PyTorch or numpy and pandas?

Yes I am using torch, so guessing it's related,

Thank you for quick response though

can you share pyoxidezer config file? it will be easy for me to point out what is missing or wrong.
(without the comments part :) )

Here my config file as well dependencies, I am able to build without torch

pyoxidizer.bzl.txt
requirements.txt

would you wait for this weekend, because i'm about to write a hello-world and how to add libraries like torch.
I will post it there #738 and also here.

Most definitely, thank you so much