$300 Food Computer Error : no module named couchdb

#1

We are having problems with our computer. We cannot collect temperature or humidity data. Below is the error message. Thank you.

pi@raspberrypi:~ $ sudo bash /home/pi/MVP/scripts/Render.sh
Move latest webcam image
/home/pi/MVP/pictures/2019-01-25_1201.jpg
Build temperature graph
Traceback (most recent call last):
File “/home/pi/MVP/python/TempChart.py”, line 11, in
from couchdb import Server
ImportError: No module named couchdb
Build humidity graph
Traceback (most recent call last):
File “/home/pi/MVP/python/HumidityChart.py”, line 6, in
from couchdb import Server
ImportError: No module named couchdb

0 Likes

#2

This is the web page graph build process, and the graphing routine is saying that it cannot find the library (couchdb) that reads from the database. It looks like releaseScript_Local.sh may not have been run when you installed the software.
I need more information to diagnose what happened here.

  1. Which git did you use to install the software?
  2. What were you doing when you got this error? You should have had a error on the validation routine when you set up the MVP.
  3. You can always try a re-install of the library:
    pip install couchdb
0 Likes

#3

Thank you for responding. I got that from https://github.com/futureag/mvp

I got the error when setting up MVP.

Thanks

0 Likes

#4

That is the right git.
Try installing the library and rerun /home/pi/MVP/setup/Validate.sh
Libraries normally install with no problems, but are occasionally issues.

0 Likes

#5

Reinstalled Lib and reran that file. I have this error message:

Validation of the MVP 3.0 directory structure and code

MVP 1.0 Validation script

—Check for directories—
/home/pi/MVP OK
/home/pi/MVP/scripts OK

—Check CouchDB —
CouchDB OK
Sensor database OK

—Test Sensors—

Test si7021

\033[0;31m 01/29/19 11:20:58 : Failure testing SI7021 sensor \033[0m

Could this be a hardware issue?

Thanks for your reply

1 Like

#6

Try following the debugging process documented here:

0 Likes

#7

I have gone through the debugging process and have changed the sensor. Before I was not getting readings on the temperature and humidity sensor. Now I am. However, I am still having the same problems. I seem to not be building graphs with couchdb. When I run localhost:8000 I see a temperature graph with old values, not current. I see a humidity graph with no data and I see the webcam image. Do I need to install the library again since the sensor is now working?

sudo bash /home/pi/MVP/scripts/Render.sh
Move latest webcam image
/home/pi/MVP/pictures/2019-02-01_1538.jpg
Build temperature graph
Traceback (most recent call last):
File “/home/pi/MVP/python/TempChart.py”, line 12, in
from couchdb import Server
ImportError: No module named couchdb
Build humidity graph
Traceback (most recent call last):
File “/home/pi/MVP/python/HumidityChart.py”, line 6, in
from couchdb import Server
ImportError: No module named couchdb

Thank you.
Seckman Senior High School in St. Louis area

0 Likes

#8

The error is that the couchdb python library cannot be found, it was either not installed, or there is a version problem (ie Python 3 verses python 2 library)…
If the graph is not created due to an error, you will see the last created graph via localhost:8000.
Since both temp and humidity fail to build, this strongly points to a library issue rather than an individual python code file.
Try a reinstall and then try running. Wish I could give better insight into this.

0 Likes

#9

We have tried this with no results. Thank you for responding so frequently. Could this be a network issue? We have a wire connect to the schools network running to the pi.

0 Likes

#10

What version of Raspbian are you running, and what is the command you ran to load couchdb? I am wondering if somehow there is a mix of Python 2 and Python 3. ie you loaded the Python 3 library, but are trying to run things with Python2.Just a guess.
From a command prompt, type ‘python’ and see what version it reports. Raspberry Pi seems to be switching from running Python 2 as the default, to running Python 3.

0 Likes

#11

We are running python 2.7.13. We installed our library from here. I am manually running the command through the actual file and launching it through the command prompt.

0 Likes

#12

Lets run a test:

put the following lines in a new file named:

/home/pi/MVP/python/c-test.py

try:
import platform
print("Version: " + platform.python_version())
import couchdb
except Exception as e:
print(e)

It doesn’t show with the formatting, but there should be a 4 space indent on each line other than the ‘try’ and ‘except’. Then from a command line, type the following:

python /home/pi/MVP/python/c-test.py

and then:

python3 /home/pi/MVP/python/c-test.py

0 Likes

#13

@webbhm I appreciate your help on this. Is this due to the migration towards Python 3?

I’m going to be doing a build from scratch tomorrow using the PowerPoint software installation guide and can confirm there are no inherent issues with the installation documentation:

@skindog Shoot me an E-mail at peter@marsfarm.io - I actually live in St. Louis as well and would love to connect and can potentially drop by to see your build/troubleshoot.

0 Likes

#14

No, nothing to do with the migration. This should all be the current stable code. I have not touched the github in months

1 Like

#15

Thank you for all your comments, we fixed the problem. I wish I could tell you what happened, but I dont know. Thanks :grinning:

0 Likes

#16

I wish you knew how it was fixed because my students are having the exact same problem.

0 Likes

#17

Try running both of the following:
pip install couchDB
pip3 install couchDB

My suspicion is that you have a conflict between Python 2 and Python 3

0 Likes

#18

Chiming in here - I had the same issue. What was strangest was that executing TempChart.py and HumidityChart.py directly from the command line worked just fine; verified that the Python versions were the same (both were running 2.7.13).

What was happening was that the PYTHONPATH did not contain Python’s site-packages directory when running Python from a bash script (e.g., sudo bash /home/pi/MVP/scripts/Render.sh, where Render.sh contains python TempChart.py), which is the directory that contains packages installed via pip. Try including the lines

import sys
print sys.path

at the very top of TempChart.py, and then run both sudo bash /home/pi/MVP/scripts/Render.sh and python TempChart.py, and see if sys.path is different between the two. In my case, '/home/pi/.local/lib/python2.7/site-packages' printed from the latter and not the former.

I added the site-packages directory to the dist-packages directory using what was suggested here (added a file site-packages.pth to dist-packages that contained '/home/pi/.local/lib/python2.7/site-packages'). Not sure if that’s best practice, so someone let me know if there’s a better way!

0 Likes

#19

I am still trying to get my head around this issue.
I believe there are differences between running
pip install …
and
sudo pip install
One installs system wide, and the other I believe only installs for the (current) user. I saw this with Light.py, where it normally runs fine, but would fail on startup (which was probably running as root).
Your solution should work.

0 Likes