No module named 'PyPulse' Error

Followed the appropriate steps in the Wiki to get Pulse working on PyCharm. Attempted to run a HowTo scenario and the following received the following error

Traceback (most recent call last):
File “C:\Windows\System32\Pulse\engine\src\python\pulse\howto\HowTo_AirwayObstruction.py”, line 7, in
from pulse.engine.PulseEngine import PulseEngine
File “c:\windows\system32\pulse\engine\src\python\pulse\engine\PulseEngine.py”, line 6, in
import PyPulse
ModuleNotFoundError: No module named ‘PyPulse’

Attempted to install PyPulse in the PyCharm package manager. I have also checked the bin location and have this file “PyPulse.cp39-win_amd64”

Unsure of what to do next to fix the errors shown.

I edit the Run/Debug Configuration of HowTo_AirwayObstruction.py and set the Working directory

Then I manually add these paths to my pycharm python interpreter (File->Settings)

If my working directory was not set, PyCharm could not find the PyPulse.cp39-win_amd64.pyd which give me the unable to find PyPulse… so I think setting that working directory should work

I set the working directory to install\bin as well as added the same paths into the into the pycharm python interpreter. Same error occurred. Currently using Python 3.11, if that may help diagnose the issue further.

Since you built pulse with python 3.9
You need to run a 3.9 interpreter in PyCharm
Those have to match

Interpreter is now Python 3.9, but same error is occurring. All else appears to be equal when comparing screenshots

What branch are you building?

I actually think building my environment is where an issue is occurring now. After reinstalling Python 3.9 the code ran on PyCharm, but failed to find the initial state. I checked the files and some files were missing that were in my original attempt to build the environment

States are genereated during the superbuild See here for regeneration of states

If your build did not finish or you don’t have the expected files in your install/bin, you will also need to generate data via run genData before you run genStates

More on our run script can be found here

I believe built the environment successfully into PyCharm as I am able to run the HowTo files successfully. However, trying to make our own code in the HowTo, it fails to find the initial state. I also receive this error

Traceback (most recent call last):
File “C:\Programming\Pulse\engine\src\python\pulse\howto\Test.py”, line 50, in
print(results[‘MeanArterialPressure (mmHg)’][0])
KeyError: ‘MeanArterialPressure (mmHg)’

The written code was running in the Jupyter notebook, as that was where it was created. The only thing done was copying and pasting it over to PyCharm

Make sure you set the working directory in the configuration
Pulse is looking for files relative to the working directory

Are you refering to a Jupyter notebook we created?

It sounds like pulse.serialize_from_file or pulse.initialize_engine was not successful

Are you sure you requested MeanArtierialPressure from pulse via a data request manager?

Working directory is set to install\bin and works when it is set to this directory, any other directory causes the PyPulse error.

Yes the code was written in the Jupyter notebook that was create. It may be usual to mention the the script written was inside the “HowTo_EngineUse” Notebook in Jupyter.

MeanArterialPressure was requested with SEDataRequestManager following the required format

If you want to run from any other working directory, you should add the folder that conatins the PyPulse.pyd file to your PYTHONPATH

You don’t need to do that if you set the working directory to a folder with PyPulse.pyd

Got it working now! The Jupyter notebook code brought the state from /data/…, there was no /data/ needed in the local Python as that folder didn’t exist. It was copied and pasted over so once the /data/ filepath portion was removed, the initial state was successfully loaded.

Awesome!

I have the same error despite reading the documentation following step by step in two different windows 11 pcs, and these posts. Using PyCharm 17.0.9, python 3.11, cmake 3.28.3. I configured the PYTHONPATH and built from source various times with the same results. I am missing files from the build folder as I cannot find any file on install/bin and no python files on Innerbuild. What am I forgetting here? thank you

There are no files in install/bin?
If there are no files there, there must be a build error.

Do you have a build log?

Thank you for your answer. Yes, no files in wither install/bin nor the Innerbuild folders. I am attaching two files for the cmake log
[CMakeConfigureLog.yaml] (https://1drv.ms/u/s!AkBJ9jCcyCJhicU3roMdUcivM5HwtA?e=2V85Bk)
CMakeCache.txt

thank you!

It looks like you are using C:/Python312/python.exe

Can you pipe your build (make command) to a file?

I also have a 4.2 docker container you may want to use instead of building the source code

I tried Docker desktop but it doesn’t run. Right after I hit run it stops and shows Exited (0) so I don’t know what I’m doing wrong. I am attaching the result of the two files, one for each command as per the documentation (pipe the build)

https://1drv.ms/t/s!AkBJ9jCcyCJhicU63dYmkhQFE8ZQ_Q?e=bINlAC

https://1drv.ms/t/s!AkBJ9jCcyCJhicU7lNmwXfLl7GCR0g?e=VHhTsY

Thank you so much for your help,