-
-
Notifications
You must be signed in to change notification settings - Fork 782
Fix PYTHONPATH handling for Python runner actions using --python3 flag #4666
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
Conversation
/usr/lib/python3.6) not being in the PYTHONPATH for Python actions which used --python3 flag. This meant some packs which rely on 3rd party packages / modules which are available as part of Python 3 standard library and also Python 2 site-packages were incorrectly loaded from Python 2 site-packages instead of Python 3 standard library.
| # one | ||
| # NOTE: abc.py is always available in base lib directory which is symlinked to virtualenv | ||
| # lib directory | ||
| abc_module_path = os.path.join(python3_lib_directory, 'abc.py') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not too happy about this approach, but from the research I did, I couldn't come up with a better one.
I will also look into it more when adding end to end tests and testing it under various Python 3 versions on all the supported versions to verify it indeed covers all the scenarios and works correctly on all the platforms.
blag
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
We're still experiencing the same issue with StackStorm HA. We have 4 internal packs and 2 of them are failing because StackStorm tries to execute their actions in Python 2 (we don't have any Python 2 code). requirements.txt: All our packs have these libraries but only 2 of them try to run in Python 2. |
|
@oatsgithub Please open a new issue for that and include all the relevant information we need to be able to reproduce the issue (StackStorm versions, packs and actions in question, action runner debug level logs, etc.). |
|
This is a great candidate for a bigfix release of v3.1. |
This pull request fixes a bug which would cause some packs to break when running Python 3 actions on installations where StackStorm components run under Python 2.
Background, Context
Some pack dependencies or action code depend on packages / modules which are available in Python 3 standard library, but they are also available in Python 2 site-packages directory (usually as an installable backport).
We didn't correctly add base Python 3 library directory (e.g.
/usr/lib/python3.6) toPYTHONPATHfor such actions so things broke because it tried to use incompatible package / module from Python 2 instead from Python 3.This pull request fixes that.
TODO
Resolves #4658.