I am now running : st2 3.0.1, on Python 2.7.12
The package in question is scikit-learn
the pack it is part of is created with the --python3 option
the error message is :
{
"stdout": "",
"result": "None",
"stderr": "Traceback (most recent call last):\n File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/python_runner/python_action_wrapper.py\", line 238, in _get_action_instance\n actions_cls = action_loader.register_plugin(Action, self._file_path)\n File \"/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/util/loader.py\", line 168, in register_plugin\n module = imp.load_source(module_name, plugin_abs_file_path)\n File \"/usr/lib/python3.5/imp.py\", line 172, in load_source\n module = _load(spec)\n File \"<frozen importlib._bootstrap>\", line 693, in _load\n File \"<frozen importlib._bootstrap>\", line 673, in _load_unlocked\n File \"<frozen importlib._bootstrap_external>\", line 665, in exec_module\n File \"<frozen importlib._bootstrap>\", line 222, in _call_with_frames_removed\n File \"/opt/stackstorm/packs/modal/actions/test.py\", line 4, in <module>\n from sklearn.gaussian_process import GaussianProcessRegressor\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/gaussian_process/__init__.py\", line 13, in <module>\n from .gpr import GaussianProcessRegressor\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/gaussian_process/gpr.py\", line 16, in <module>\n from .kernels import RBF, ConstantKernel as C\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/gaussian_process/kernels.py\", line 31, in <module>\n from ..metrics.pairwise import pairwise_kernels\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/metrics/__init__.py\", line 7, in <module>\n from .ranking import auc\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/metrics/ranking.py\", line 35, in <module>\n from ..preprocessing import label_binarize\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/preprocessing/__init__.py\", line 6, in <module>\n from ._function_transformer import FunctionTransformer\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/preprocessing/_function_transformer.py\", line 5, in <module>\n from ..utils.testing import assert_allclose_dense_sparse\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/utils/testing.py\", line 61, in <module>\n from nose.tools import raises as _nose_raises\n File \"/opt/stackstorm/st2/lib/python2.7/site-packages/nose/__init__.py\", line 1, in <module>\n from nose.core import collector, main, run, run_exit, runmodule\n File \"/opt/stackstorm/st2/lib/python2.7/site-packages/nose/core.py\", line 153\n print \"%s version %s\" % (os.path.basename(sys.argv[0]), __version__)\n ^\nSyntaxError: invalid syntax\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/python_runner/python_action_wrapper.py\", line 334, in <module>\n obj.run()\n File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/python_runner/python_action_wrapper.py\", line 192, in run\n action = self._get_action_instance()\n File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/python_runner/python_action_wrapper.py\", line 245, in _get_action_instance\n raise exc_cls(msg)\nSyntaxError: Failed to load action class from file \"/opt/stackstorm/packs/modal/actions/test.py\" (action file most likely doesn't exist or contains invalid syntax): invalid syntax (core.py, line 153)\n\nTraceback (most recent call last):\n File \"/opt/stackstorm/st2/local/lib/python2.7/site-packages/python_runner/python_action_wrapper.py\", line 238, in _get_action_instance\n actions_cls = action_loader.register_plugin(Action, self._file_path)\n File \"/opt/stackstorm/st2/lib/python2.7/site-packages/st2common/util/loader.py\", line 168, in register_plugin\n module = imp.load_source(module_name, plugin_abs_file_path)\n File \"/usr/lib/python3.5/imp.py\", line 172, in load_source\n module = _load(spec)\n File \"<frozen importlib._bootstrap>\", line 693, in _load\n File \"<frozen importlib._bootstrap>\", line 673, in _load_unlocked\n File \"<frozen importlib._bootstrap_external>\", line 665, in exec_module\n File \"<frozen importlib._bootstrap>\", line 222, in _call_with_frames_removed\n File \"/opt/stackstorm/packs/modal/actions/test.py\", line 4, in <module>\n from sklearn.gaussian_process import GaussianProcessRegressor\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/gaussian_process/__init__.py\", line 13, in <module>\n from .gpr import GaussianProcessRegressor\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/gaussian_process/gpr.py\", line 16, in <module>\n from .kernels import RBF, ConstantKernel as C\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/gaussian_process/kernels.py\", line 31, in <module>\n from ..metrics.pairwise import pairwise_kernels\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/metrics/__init__.py\", line 7, in <module>\n from .ranking import auc\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/metrics/ranking.py\", line 35, in <module>\n from ..preprocessing import label_binarize\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/preprocessing/__init__.py\", line 6, in <module>\n from ._function_transformer import FunctionTransformer\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/preprocessing/_function_transformer.py\", line 5, in <module>\n from ..utils.testing import assert_allclose_dense_sparse\n File \"/opt/stackstorm/virtualenvs/modal/lib/python3.5/site-packages/sklearn/utils/testing.py\", line 61, in <module>\n from nose.tools import raises as _nose_raises\n File \"/opt/stackstorm/st2/lib/python2.7/site-packages/nose/__init__.py\", line 1, in <module>\n from nose.core import collector, main, run, run_exit, runmodule\n File \"/opt/stackstorm/st2/lib/python2.7/site-packages/nose/core.py\", line 153\n print \"%s version %s\" % (os.path.basename(sys.argv[0]), __version__)\n ^\nSyntaxError: invalid syntax\n\n",
"exit_code": 1
}
the end of the error suggest that a python2 library is used insted of its python3 counterpart.
From the virtaulenv itself all works well:
(modal) root@ubuntu:/opt/stackstorm/virtualenvs/modal# python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sklearn