ModuleNotFoundError when trying to execute Python using ansible

Hi, everyone
I’m trying to execute Python Files on EC2 using ansible

I got an error message like this

'import influxdb\nModuleNotFoundError: No module named ‘influxdb’

I installed ‘influxdb’ module on EC2
and it works well when I connected EC2 directly and execute Python directly.

But, it doesn’t work when using ansible…

Help ! Thanks

Can you please share ansible --version and influxdb installed location?

There might be a difference between Python used interactively and used by Ansible.