Search code examples
pythonconfigurationapama

How to configure Apama with Python plugin support


I'm trying to use a Python plugins in Apama. Unfortunately I always get the following error message when starting the correlator.

Failed to initialize correlator: Could not initialise the Python plugin. Set AP_PYTHONHOME to the location of python

If I test it locally, the application will work fine. But as soon as I switch to the production system and try to call the Python application via the .mon file this error occurs.

Can anyone tell me why it can't initialize Python?

Apama is configured and started using the following command.

/correlator --config /opt/apama-rules/deploy --applicationLogLevel DEBUG -l /usr/apama/properties/apama/license/icense.xml
2019-01-31 13:39:27.479 ##### [140402990063488] - There are 2 CPU(s)
2019-01-31 13:39:27.479 ##### [140402990063488] - Correlator command line: ./correlator --config /opt/apama-rules/deploy --applicationLogLevel DEBUG -l /usr/apama/properties/apama/license/ApamaServerLicense.xml
2019-01-31 13:39:27.479 ##### [140402990063488] - Current Working Directory: /opt/Apama/bin
2019-01-31 13:39:27.479 ##### [140402990063488] - PATH: /opt/Apama/bin:/jre/bin:/bin:/jre/../bin:/sbin:/usr/sbin:/bin:/usr/bin
2019-01-31 13:39:27.479 ##### [140402990063488] - LD_LIBRARY_PATH: /opt/apama-rules/deploy/lib:/apamawork_10.3/lib:/opt/Apama/lib:/jre/lib/amd64/server:/jre/lib/amd64
2019-01-31 13:39:27.480 ##### [140402990063488] - Current UTC time: 2019-01-31 12:39:27, local timezone: TZ not set so using system default
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - port                     = 15903
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - output queue size        = 10000
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - output queue batch size  = 100
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - output queue mode        = blocking
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - environment variable     = APAMA_PLATFORM=amd64-rhel7
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - environment variable     = AP_PYTHONHOME=/opt/Apama/third_party/python/lib/python3.6/site-packages
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - environment variable     = APAMA_LIBRARY_VERSION=10.3
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - environment variable     = APAMA_JRE=/jre
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - environment variable     = APAMA_ENVSET=10.3:/opt/Apama:amd64-rhel7
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - environment variable     = APAMA_WORK=/apamawork_10.3
2019-01-31 13:39:27.480 ##### [140402990063488] - Input value - environment variable     = APAMA_HOME=/opt/Apama
2019-01-31 13:39:27.480 ##### [140402990063488] - Using memory allocator                 = TBB scalable allocator
[...]
2019-01-31 13:39:27.717 ERROR [140402990063488] - Failed to initialize correlator: Could not initialise the Python plugin. Set AP_PYTHONHOME to the location of python

Solution

  • Ok the problem was that the python default version linked to 2.7 I changed the version to version 3. alias python='/usr/bin/python3'.