Python Forum
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
Reply


Messages In This Thread
Missing something here - by Robpl1 - Jan-14-2019, 10:23 AM
RE: Missing something here - by mlieqo - Jan-14-2019, 10:33 AM
RE: Missing something here - by Gribouillis - Jan-14-2019, 10:35 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020