Using Python27 as the default Python, maybe

Latest response

I hope this makes sense

I'm currently setting up a system using a software package called Cortex.

https://github.com/TheHive-Project/Cortex

It uses a number of plugins that it calls Analyzers that run in either Python 2 or Python3.

https://github.com/TheHive-Project/Cortex-Analyzers/

I installed python27 and rh-python36 from SCL and installed the dependencies fine.

When cortex runs the analysers it fails because it can't find the required module. from python, I suspect it's because it's not running the right version of Python.

I'm curious about if there is away where I can configure the Cortex application (runs under it's own user) to use the correct version of python.

Thanks.

Invalid output
Traceback (most recent call last):
  File "VirusTotal/virustotal.py", line 8, in <module>
    from cortexutils.analyzer import Analyzer
ImportError: No module named cortexutils.analyzer
{
  "errorMessage": "Invalid output\nTraceback (most recent call last):\n  File \"VirusTotal/virustotal.py\", line 8, in <module>\n    from cortexutils.analyzer import Analyzer\nImportError: No module named cortexutils.analyzer\n",
  "input": null,
  "success": false
}

Responses

Based on the 2.7 Python, I'm guessing you're using RHEL 7.

I'm not an expert - apologies - but I'm guessing the app can't find Python in the normal path location. You might find an answer here: https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/3/html-single/Packaging_Guide/#sect-Providing_syspaths_Subpackages

Also, you need to ensure RHSCLs persist after reboot: https://access.redhat.com/solutions/527703

(OR someone will trump me with a better suggestion.)

Thanks for your response. I think this is the section that will probably work in my use case.

https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/3/html-single/Packaging_Guide/#sect-Configuring_an_Environment_for_Services

What I can't seem to figure out is how to enable multiple software collections, I guess I'll try a few things and see if it works.

Hi Jeremy, I have the same issue with RH y Cortex, did you solve the problem?

It hopefully gets you closer.

There's this section too: https://access.redhat.com/documentation/en-US/Red_Hat_Software_Collections/3/html-single/Packaging_Guide/#sect-Enabling_the_Software_Collection

Hi Ricardo, I did actually get it resolved. I edited the following file "/etc/systemd/system/cortex.service" and under the option "ExecStart=" I modified the command to look like the following

ExecStart=/bin/scl enable rh-python36 python27 '/opt/cortex/bin/cortex -Dconfig.file=/etc/cortex/application.conf -Dlogger.file=/etc/cortex/logback.xml -Dpidfile.path=/dev/null'

And that allows both the Python2 and Python3 Cortex analyzers to run. Hope that helps.

Thanks Jeremy, I changed the configuration and analyzers run without problems.

Close

Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.