pyactivemq on Ubuntu

pyactivemq is a Python library that enables Python clients to communicate with ActiveMQ using both OpenWire and Stomp protocols. To do that it wraps ActiveMQ-CPP library, so it involves some compiling to make it all work. While building instructions for both ActiveMQ-CPP and pyactivemq and clear and concise, I found some additional steps were need to make it all work on Ubuntu box. I’ll post it here for my future reference and hopefully it can be useful to other folks.

This is tested with ActiveMQ-CPP version 2.2.6 and activemqpy 0.1.0

Let’s start with ActiveMQ-CPP. ActiveMQ-CPP depends on a couple of libraries listed on the wiki page. You can easily obtain them using something like:

$ sudo apt-get install autoconf
$ sudo apt-get install automake
$ sudo apt-get install libtool
$ sudo apt-get install uuid-dev
$ sudo apt-get install libcppunit-dev

But you also need to install the build-essential package with

sudo apt-get install build-essential

This is now added to the wiki as well

Before starting the build, you’ll also need to install APR-util and APR libraries. Steps are pretty forward, so I’ll skip them here.

Now we’re finally ready to start the ActiveMQ-CPP build. By following instructions on the wiki page, you should have ActiveMQ-CPP installed into /usr/local/include/activemq-cpp-x.x.x/.

So, let’s get back to the pyactivemq. First thing you need to do is to edit and point it to the location where ActiveMQ-CPP is installed. You can do that by changing all /opt/activemq-cpp-x.x.x references to your /usr/local/include/activemq-cpp-x.x.x/

For successful build of pyactivemq you need to install one more dependency (Boost.Python) and you can do that with the following command:

sudo apt-get install libboost-python-dev

After these steps you can build and install pyactivemq.

There is just one more thing to do in order to successfully run scripts that use pyactivemq. You need to add ActiveMQ-CPP location to the list of shared libraries. To do that add the following line:


to the /etc/ file and run

$ sudo ldconfig

It’s finally ready. To test it, start your broker, go to the src/examples directory and run

$ python

Enjoy writing your Python application using ActiveMQ and pyactivemq.


  1. Hi,

    I followed the steps you have mentioned to install ActiveMQ and pyactivemq(pyactivemq-0.1.0).
    everything went fine but when I am trying to “build and install pyactivemq”
    its throwing erros.
    i have changed the line in /opt/activemq-cpp-2.2.1/include/activemq-cpp-2.2.1 to /usr/local/include/activemq-cpp-3.0.1/

    when i run python build
    the print statements on console are:

    running build
    running build_ext
    building ‘pyactivemq’ extension
    gcc -pthread -fno-strict-aliasing -DSTACKLESS_FRHACK=0 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DBOOST_PYTHON_NO_PY_SIGNATURES=1 -DPYACTIVEMQ_ENABLE_DOCSTRINGS=0 -I/usr/local/include/activemq-cpp-3.0.1 -I/usr/local/include/python2.5 -c src/main/Destinations.cpp -o build/temp.linux-i686-2.5/src/main/Destinations.o
    cc1plus: warning: command line option “-Wstrict-prototypes” is valid for Ada/C/ObjC but not for C++
    src/main/Destinations.cpp: In function ‘void export_Destinations()’:
    src/main/Destinations.cpp:95: error: ‘toProviderString’ is not a member of ‘cms::Destination’
    src/main/Destinations.cpp:96: error: ‘toProviderString’ is not a member of ‘cms::Destination’
    src/main/Destinations.cpp:98: error: ‘toProviderString’ is not a member of ‘cms::Destination’
    src/main/Destinations.cpp: At global scope:
    src/main/Destinations.cpp:40: warning: ‘DestinationType_docstring’ defined but not used
    error: command ‘gcc’ failed with exit status 1

    I am not able to proceed further
    can you give me some solution, so that i can use it ActiveMQ in python
    plz help me


  2. Hi,

    thinks it would be the best to seek a solution on a project’s user forum.


Comments are closed.