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
Segmentation fault when accessing a large object after successful reading of that object from file #6676
Comments
Can you check if libraries listed in pyinstaller/pyinstaller-hooks-contrib#375 (comment) are duplicated in your build? |
@rokm Yes, they are duplicated! Let me try making the top-level files as symlinks to the ones in torch/lib/, as you suggested. Thank you. |
@rokm Thank you, it now works in However, to get it working for |
You need to make the changes (remove the duplicates, create the links) programmatically, at the start of your python program. I.e., remove the offending files in the temporary directory indicated by It's inelegant and wasteful, but it's currently the only way for onefile mode if you really have to use it. |
Or, you could remove the offending duplicates if you build via .spec file instead of directly from .py. In that case, you could filter You'll still need to create symlinks programmatically at the program start, though. |
@rokm Thank you so much! I've got it working as a |
System: M1 Macbook Pro (macOS Monterey), miniconda
I have frozen a single python script and its associated data (using the --add-data option) to a single dir (using --one-dir). This freezing runs without any errors.
Inside this script, I have a function which reads in one of the data files. Specifically, I have
state_dict = torch.load('weights/model.pth', map_location='cpu')
, which is a PyTorch function to read model weights from a saved file.This reading of weights also runs successfully.
However, when I have a statement that accesses these weights such as
x=state_dict['config']
or evenprint(state_dict)
, the program crashes withzsh: segmentation fault
. There is no other output.The python script runs successfully without pyinstaller, which is why I do not suspect any memory issues.
Could you please help me out? Thank you.
Additional: I had also encountered another error previously stating that
libomp.dylib
was missing, although it was already there in another folder. So, I copiedlibomp.dylib
to the folder where pyinstaller wasn't able to find it. This duplication oflibomp.dylib
raised a warningInitializing libomp.dylib, but found libomp.dylib already initialized
which I silenced byexport KMP_DUPLICATE_LIB_OK=TRUE
. The warning mentioned that this may cause issues. Could this be the reason behind seg fault?Similar Issue - https://stackoverflow.com/questions/64575925/pyinstaller-exe-crashing-during-run-without-error-message
The text was updated successfully, but these errors were encountered: