Python cayenne-mqtt: No module named client


#1

I am trying to setup a python script to send some data to Cayenne from a raspberry pi 3 using the Cayenne-MQTT-Python, but I get this error:

import cayenne.
ImportError: No module named client

I also tried only importing cayenne and this is the error I got:

client = cayenne.client.CayenneMQTTClient()
AttributeError: 'module' object has no attribute 'client'

I tried running it with both python 2 and 3 with no luck.

What am I doing wrong?


#2

How did you install the python library?


#3
pip install cayenne-mqtt

#4

Did you run the install with sudo? I have not tested if this library installs without it. I used the following commands and it works ok.

sudo pip install cayenne-mqtt
python
import cayenne.client

No errors displayed for me.

Try reinstalling the library with sudo pip install cayenne-mqtt


#5

hmm, I don’t remember if I used sudo for that or not, I’ll test it out when I can and let you know, thanks!


#6

I seem to be having the same problem did this ever get resolved?


#7

I also tried to re-install the library and still doesn’t work…

pi@raspberrypi:~ sudo pip install cayenne-mqtt Requirement already satisfied: cayenne-mqtt in /usr/local/lib/python2.7/dist-packages/cayenne_mqtt-1.0.1-py2.7.egg Requirement already satisfied: paho-mqtt>=1.0 in /usr/local/lib/python2.7/dist-packages/paho_mqtt-1.3.1-py2.7.egg (from cayenne-mqtt) pi@raspberrypi:~ python
Python 2.7.13 (default, Jan 19 2017, 14:48:08)
[GCC 6.3.0 20170124] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.

import cayenne
Traceback (most recent call last):
File “”, line 1, in
File “cayenne.py”, line 2, in
import cayenne.client
ImportError: No module named client


#8

I just pulled the git repo and I used it that way…


#9

I tried that too and didn’t work until I put my code file into the example directory. Why that makes a difference I guess I have no clue right now.


#10

Hmm I thought I posted that, maybe it was somewhere else. Yes you must put the files in a directory outside the library folder,