Reputation: 2678
I am trying to import and use psutil
from within a python-script (.py
file).
This .py
file is part of a juju-charm
layer. To be specific, it is a command
script for collecting metrics
from the machine running the charm-application
:
#!/usr/bin/env python3
import psutil
if __name__ == '__main__':
cpu_times = psutil.cpu_times(percpu=False)
print(cpu_times )
Now when I build the charm-layer
and deploy it using juju
, I get the following error:
ImportError: No module named psutil
This means that the machine (which was brought up by juju
) called and invoked that .py
file successfully. But failed to import psutil
.
My question is how to import psutil
successfully?
(I will highly appreciate a juju-charm
related answer if there is any but it is not necessary)
Upvotes: 1
Views: 7193