Python API

Hi all,

Following the instructions in the wiki, I was able to build Pulse with Python API support. I have my PYTHONPATH also updated appropriately. Looks like the pulse.cdm.bind module is missing? See below for the output from running a howto script. What have I misunderstood here? Any ideas.


schimaku@eri:~/Development/Pulse/engine/src/python/pulse/howto$ python3
Traceback (most recent call last):
File “”, line 7, in
from pulse.cpm.PulsePhysiologyEngine import PulsePhysiologyEngine
File “/home/schimaku/Development/Pulse/engine/src/python/pulse/cpm/”, line 9, in
from import serialize_actions_to_string,
File “/home/schimaku/Development/Pulse/engine/src/python/pulse/cdm/io/”, line 6, in
from pulse.cdm.bind.Engine_pb2 import AnyActionData,
ModuleNotFoundError: No module named ‘pulse.cdm.bind’

Hi epitomeri

You should have added 2 paths to your PYTHONPATH, the location of the python shared object, as well as the python folder as part of the pulse source code

Your path should look something like:

ENV PYTHONPATH /source/src/python:/pulse/bin

The error looks like you did not add the folder from the source code…

What is your python path?

Hi Aaron,

I believe that my PYTHONPATH is as expected. Please see below.

schimaku@eri:~$ echo $PYTHONPATH

The /src/python folder contains the following:
CMakeLists.txt pulse pybind venv

The ‘bin’ folder is the one that contains ‘’.

What else could I be missing?

Thanks in advance,

Do you have any files in your


aaron.bray@krs-812:~/Programming/pulse/engine/src/python/pulse/howto$ ls ~/Programming/pulse/engine/src/python/pulse/cdm/bind/ __pycache__

No, as I mentioned in my original email, that module is missing somehow. There is no folder by name ‘bind’ under ‘cdm’. Have I not installed Pulse correctly? I did use the flag ‘-DPulse_PYTHON_API:BOOL=ON’ in my cmake command.

Those should have been generated during the build
I am currently generating these files in the source directory, which is not great…

You can regenerate those missing files by running this script from your install/bin

aaron.bray@krs-812:~/Programming/builds/manual/pulse-engine/install/bin$ ./ protoc

Hi epitomeri

I found a few issues I needed to correct to get python running.
I pushed them to the head of 3.x, should be a quick rebuild if you make install from the Innerbuild

You should be good to go!

Let me know if you are still having issues!

Thanks. In general, my Python build issues got resolved after I switched to 3.x branch from Master! The build is successful and the ‘bind’ folder is in place.

schimaku@eri:~/Development/Pulse-3.0/engine/src/python/pulse/howto$ python3
Unable to load initial state file

Could you tell me where to find the inputs necessary to run the scripts in the ‘howto’ folder? Running one of them threw an error as you can see above. Since I am a first time user, my goal is to go through some examples to understand what it is that Pulse can/cannot do. I figured that the scripts in the ‘howto’ folder are a good starting point unless you recommend otherwise.

Thanks in advance,

Hi Satish,

I accidentially responded to your question on the wrong forum thread

Moving the answer to this thread now

The HowTo files all load up a saved state that is found in your install/bin/states folder.
In the code, they are specified via a relative directory, so these how to files are expected to be run in the install/bin folder, like this:

aaron.bray@krs-812:~/Programming/builds/manual/pulse-engine/install/bin$ python3 ~/Programming/pulse/engine/src/python/pulse/howto/

I also run via PyCharm and just change the working directory
Note, There is a pycharm project in the source/src/python folder you can point pycharm to

I will add this to the python wiki page

Thanks Aaron. It worked now!

Privacy Notice