nipype / pydra

Pydra Dataflow Engine
https://nipype.github.io/pydra/
Other
119 stars 57 forks source link

`psutil` dependency missing for Audit features #760

Open bclenet opened 5 days ago

bclenet commented 5 days ago

What version of Pydra are you using?

0.23 (Python 3.10.11)

What were you trying to do?

Following the tutorial (commit e1c91e3) for FunctionTask#Using Audit part.

What did you expect will happen?

I expected the provided code to run nicely.

What actually happened?

ModuleNotFoundError: No module named 'psutil'

The error is due to the fact that psutil is included in the tests optional-dependencies only, although it seems like it is needed by the Audit features.

Can you replicate the behavior? If yes, how?

Yes, here is how :

Create a test_pydra_tutorial.py file containing:

# Contents of test_pydra_tutorial.py
from pydra.mark import task
from pydra.utils.messenger import AuditFlag, PrintMessenger

@task
def add_var(a: int, b: int) -> {'out': int}:
    return a+b
task0 = add_var(
    a = 4, b = 5,
    audit_flags = AuditFlag.RESOURCE # This line causes the error
    )
task0()
print(task0.result())

Create a virtualenv and activate it

virtualenv pydra_test_venv
source pydra_test_venv/bin/activate

Then inside the virtualenv

pip install pydra
python test_pydra_tutorial.py