Bottom Page

Thread Rating:
  • 2 Vote(s) - 4 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Missing something here
#1
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 web_plants.py
Traceback (most recent call last):
File "web_plants.py", line 2, in <module>
import psutil
ImportError: No module named 'psutil'

However

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?

MTIA

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.

R
You like this post
Quote
#2
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:
python3 web_plants.py
or install psutil as root:
sudo pip install psutil
You like this post
Quote
#3
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
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Missing required dependencies when using pyinstaller Ghonim 14 469 Mar-08-2019, 09:54 AM
Last Post: dmag
  missing 1 required positional argument error nikos 3 175 Feb-28-2019, 12:53 PM
Last Post: nikos
  Missing 2 Required Positional Arguments: SwiftWater 1 83 Feb-28-2019, 08:57 AM
Last Post: buran
  How to define Missing value on some certain conditions? FreddieTheCat 3 217 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 291 Nov-21-2018, 06:50 PM
Last Post: Parthasarathi009
  edit text files/ add lines if missing (regex) wardancer84 3 263 Nov-08-2018, 02:47 PM
Last Post: wardancer84
  go_to() missing 1 required positional argument: 'url' HMAeymo 1 706 Aug-15-2018, 08:38 PM
Last Post: micseydel
  lxml missing libxml2, libxslt cawtx 3 1,509 Jul-13-2018, 11:49 PM
Last Post: snippsat
  SyntaxError: Missing parentheses in call to 'print' sofret 3 1,462 Jun-15-2018, 03:23 PM
Last Post: buran
  Build applet utility missing MaxN 0 377 May-03-2018, 06:59 PM
Last Post: MaxN

Forum Jump:


Users browsing this thread: 1 Guest(s)