Error starting Python agent
search cancel

Error starting Python agent

book

Article ID: 426421

calendar_today

Updated On:

Products

DX Application Performance Management

Issue/Introduction

IMP module error when starting Python agent preveting application from starting:

Output from command line:

(venv) $ AGENT_PROFILE="$VIRTUAL_ENV/lib/python3.12/site-packages/ca_apm_agent/directives/agent.profile"

(venv) $ ca-apm-runpy -a "$AGENT_PROFILE" python hello.py

CA APM PYTHON AGENT: Setting up Environment

CA APM PYTHON AGENT: Attempting to Bootstrap and Run "-a /Path/site-packages/ca_apm_agent/directives/agent.profile python hello.py"

Error in sitecustomize; set PYTHONVERBOSE for traceback:

ModuleNotFoundError: no module named 'imp'

Fatal Python error: init_import_site: Failed to import the site module

Python runtime state: initialized

Traceback (most recent call last):

  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load

  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked

  File "<frozen importlib._bootstrap>", line 946, in _load_unlocked

KeyError: 'site'

Environment

DX OI Agents SaaS.
DX OI Agents on Premise 24x and 25x

Cause

This is caused by the incompatibility of our Agent with Python 3.12 afterwards.
Currently, DX APM Agents release use IMP module in our hardcode, This module is no longer part of the Python standard library. It was removed in Python 3.12 after being deprecated in Python 3.4.

 

 

Resolution

A certification request is in place in order to remove IMP module from DX APM Agents' code.
For now, we support Python 3.12 and early release.

 

Additional Information

Python official announcement