Skip to content

Using a different python version for a pack is no longer working. actionrunner.python_binary #5310

Open
@wingiti

Description

@wingiti

SUMMARY

Using a different python version (in my case 3.7) for packs instead of the default system one (3.6) is not working.
Till Stackstorm 3.4 this worked like described in the docs:
https://docs.stackstorm.com/latest/packs.html?highlight=python_binary#python-versions-in-pack-python-virtual-environment

STACKSTORM VERSION

Paste the output of st2 --version:
st2 3.5.0, on Python 3.6.8

OS, environment, install method

I think it doesn't matter. I tried on our System RHEL 7 and the OVA image of Stackstorm 3.5.0

Steps to reproduce the problem

Add a different python binary to st2.conf for packs:

[actionrunner]
python_binary = /usr/bin/python3.7

Expected Results

The pack should be run using python 3.7 and finish successful.

Actual Results

The execution stops and throws an error:

Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/python_runner/python_action_wrapper.py", line 35, in <module>
    import orjson
ModuleNotFoundError: No module named 'orjson'

Using some debug output in my action I was able to verify that the binary mentioned in the config is used.

As further debug step I tried following config and installed Stackstorm requirements for python3.7:

[actionrunner]
python_binary = /usr/bin/python3.7
virtualenv_opts =  --system-site-packages

It resulted in a different error:

Traceback (most recent call last):
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/python_runner/python_action_wrapper.py", line 59, in <module>
    from st2common import log as logging
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2common/log.py", line 32, in <module>
    from st2common.logging.handlers import FormatNamedFileHandler
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2common/logging/handlers.py", line 24, in <module>
    from st2common.util import date as date_utils
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/st2common/util/date.py", line 24, in <module>
    import udatetime
  File "/opt/stackstorm/st2/lib/python3.6/site-packages/udatetime/__init__.py", line 20, in <module>
    from udatetime.rfc3339 import (
ModuleNotFoundError: No module named 'udatetime.rfc3339'

udatetime was also part of the installed requirements. Therefore I stopped debugging at this point in time and hope you can help to solve it as I don't know which change resulted in this issue.

In addition I opened a post in the forum, but I think this GIT issue is maybe the better place as it is still an option mentioned in the docs and no longer working.
https://forum.stackstorm.com/t/how-to-use-different-python-version-v3-7-for-actionrunner-python-binary-no-longer-working/1786

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions