Bottom Page

Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Missing something here
Hi all,
Never used Python before so I'm using some scripts someone else has created for an automated watering system running on a RaspberryPi (Raspbian Stretch - a Debian fork IIRC). This system uses Flask and psutil, and it's in this last that the problem seems to lie. I installed this using the command
:~ $ python3.5 -m pip install psutil

pip is at version 9.0.1

which returned, after a few seconds the message "Successfully installed psutil-5.4.8". All well and good! So now to run the code which returns

:~ $ sudo python3
Traceback (most recent call last):
File "", line 2, in <module>
import psutil
ImportError: No module named 'psutil'


pi@water1:~ $ python3
Python 3.5.3 (default, Sep 27 2018, 17:25:39)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import psutil

So the problem appears to be that the import command from within the script can't find the module.
The location of psutil is at /home/pi/.local/lib/python3.5/site-packages so it's definitely there. Am I missing something in a config file or is there another reason for this?


Solved my problem myself by copying the psutil folder in to the directory where the scripts were. However, I'd still like to know why it couldn't find the original install module.

You like this post
I'd guess it's because you installed psutil lib locally just for user 'pi' and you are trying to run your script as root which is missing the psutil library. Either run your script as 'pi' user:
or install psutil as root:
sudo pip install psutil
You like this post
The problem is that you can do a systemwide install with sudo python3 -m pip install psutil and you did a user install wich is only usable under your login. You need to uninstall and reinstall systemwide.
You like this post

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  spwd module missing in iOS dr_atomic 3 172 Jun-14-2019, 10:32 AM
Last Post: noisefloor
  Find index of missing number parthi1705 3 192 May-07-2019, 10:52 AM
Last Post: avorane
  missing 1 required positional argument: psosmol 7 711 Apr-16-2019, 10:07 AM
Last Post: DeaD_EyE
  Missing required dependencies when using pyinstaller Ghonim 14 1,267 Mar-08-2019, 09:54 AM
Last Post: dmag
  missing 1 required positional argument error nikos 3 907 Feb-28-2019, 12:53 PM
Last Post: nikos
  Missing 2 Required Positional Arguments: SwiftWater 1 618 Feb-28-2019, 08:57 AM
Last Post: buran
  How to define Missing value on some certain conditions? FreddieTheCat 3 313 Jan-14-2019, 01:35 AM
Last Post: scidam
  help for Kaggle Titanic Set fill the missing Age by median age of Pclass and Sex Parthasarathi009 2 572 Nov-21-2018, 06:50 PM
Last Post: Parthasarathi009
  edit text files/ add lines if missing (regex) wardancer84 3 361 Nov-08-2018, 02:47 PM
Last Post: wardancer84
  go_to() missing 1 required positional argument: 'url' HMAeymo 1 1,039 Aug-15-2018, 08:38 PM
Last Post: micseydel

Forum Jump:

Users browsing this thread: 1 Guest(s)