Error Message "cannot find factory: mxpi_classpostprocessor" Is Displayed When the run.sh Script Is Executed

Symptom

Go to the MyFirstApp/src directory and run the compilation script ./run.sh. If the following error information is displayed, the model postprocessing plugin cannot be found.

E20220525 07:10:11.514457 123253 MxsmElement.cpp:413] [6014][element invalid factory] Feature is NULL, can not find the element factory: mxpi_classpostprocessor
E20220525 07:10:11.514672 123253 MxsmElement.cpp:779] factoryName(mxpi_classpostprocessor) is an invalid element factory.
E20220525 07:10:11.514691 123253 MxsmStream.cpp:1853] [6014][element invalid factory] mxpi_classpostprocessor0 is an invalid element of mxpi_classpostprocessor.
E20220525 07:10:11.514716 123253 MxsmStream.cpp:725] [6014][element invalid factory] Creates classification Stream failed.
E20220525 07:10:11.514737 123253 MxStreamManagerDptr.cpp:549] [6014][element invalid factory] create stream(classification) failed.
E20220525 07:10:11.514768 123253 main.cpp:103] [6014][element invalid factory] Failed to create Stream.

Possible Causes

The Python version is incorrect and environment variables are not correctly configured. As a result, the correct library cannot be found.

Solution

  1. Run the following command to check the Python version. If Python 3.9.2 is not returned, install Python 3.9.2 by referring to Install Python 3.9.2.
    python3 --version 
  2. Copy libpython3.9.so.1.0 in the Python 3.9.2 installation directory to /usr/lib64/.
    mkdir /usr/lib64
    cp /usr/local/Python-3.9.2/libpython3.9.so.1.0 /usr/lib64/
  3. Clear the historical cache of GStreamer.
    rm ~/.cache/gstreamer-1.0/registry.aarch64.bin
  4. Run the script again.
    ./run.sh