fix: isolate PyInstaller library paths for subprocess calls#8628
Open
dcabib wants to merge 1 commit intoaws:developfrom
Open
fix: isolate PyInstaller library paths for subprocess calls#8628dcabib wants to merge 1 commit intoaws:developfrom
dcabib wants to merge 1 commit intoaws:developfrom
Conversation
When SAM CLI runs from the native installer (PyInstaller-based), it sets LD_LIBRARY_PATH/DYLD_LIBRARY_PATH to include bundled libraries. This causes conflicts when spawning external processes like npm, node, or pip that need system libraries (e.g., OpenSSL version mismatch on Fedora 43). This change: - Detects PyInstaller bundle via sys._MEIPASS - Filters bundled library paths from environment variables early in CLI init - Ensures external processes use system libraries instead of bundled ones Fixes aws#8542
bnusunny
requested changes
Feb 5, 2026
|
|
||
| # Filter out paths that are inside the PyInstaller bundle | ||
| filtered_paths = [ | ||
| p for p in paths if not p.startswith(meipass) and "_internal" not in p and "dist/_internal" not in p |
Contributor
There was a problem hiding this comment.
The current filtering logic might be slightly too broad. The "_internal" not in p check could theoretically filter legitimate system paths containing "_internal". Consider making it more specific:
filtered_paths = [
p for p in paths
if not (p.startswith(meipass) or
p.endswith("/_internal") or
"dist/_internal" in p)
]
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
When SAM CLI runs from the native installer (PyInstaller-based), it sets LD_LIBRARY_PATH/DYLD_LIBRARY_PATH to include bundled libraries. This causes conflicts when spawning external processes like npm, node, or pip that need system libraries (e.g., OpenSSL version mismatch on Fedora 43).
Changes
Testing
Fixes #8542
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.