prwiley
Posts: 11
Joined: Tue Jun 19, 2018 2:08 pm
Location: Pennsylvania USA

MQTT and Python in 2019

Wed Jan 16, 2019 7:56 pm

I have been trying to install mosquitto on my raspberry pi and have run into the installation problems well documented elsewhere on this forum. I was following these instructions: https://www.switchdoc.com/2018/02/tutor ... pberry-pi/

Bottom line is that mosquitto is not installed. No files get put in etc/.

I have two questions.

1) Can anyone say for sure if it is in 1/2019, possible to install mosquitto on a raspberry pi? If so, how, please.

2) If I can't get mosquitto to install, what's the next best choice for MQTT on raspberry pi?

User avatar
bensimmo
Posts: 4125
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: MQTT and Python in 2019

Wed Jan 16, 2019 8:14 pm

sudo pip3 install paho-mqtt
For Python3 since it's 2019

mattmiller
Posts: 2079
Joined: Thu Feb 05, 2015 11:25 pm

Re: MQTT and Python in 2019

Wed Jan 16, 2019 9:37 pm

The "trick" with installing mosquitto on a Pi is to ignore everything on T'internet and start with fresh Raspbian install and simply type in

Code: Select all

sudo apt-get install mosquitto mosquitto-clients
which will install and run a mosquitto broker service on your Pi listening out on port 1883

If you want to write some code in python then

Code: Select all

sudo pip install paho-mqtt 
The last time I did personally this was back in Nov 2018 so technically it might be broken in 2019 but I'd wage £5 it still works

DirkS
Posts: 9872
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: MQTT and Python in 2019

Wed Jan 16, 2019 9:41 pm

bensimmo wrote:
Wed Jan 16, 2019 8:14 pm
sudo pip3 install paho-mqtt
For Python3 since it's 2019
That doesn't install mosquitto, just the Python module to send / receive MQTT messages.
Has been like that for several years and still the case in 2019...

User avatar
bensimmo
Posts: 4125
Joined: Sun Dec 28, 2014 3:02 pm
Location: East Yorkshire

Re: MQTT and Python in 2019

Thu Jan 17, 2019 12:21 pm

DirkS wrote:
Wed Jan 16, 2019 9:41 pm
bensimmo wrote:
Wed Jan 16, 2019 8:14 pm
sudo pip3 install paho-mqtt
For Python3 since it's 2019
That doesn't install mosquitto, just the Python module to send / receive MQTT messages.
Has been like that for several years and still the case in 2019...
And the title of the topic is MQTT and Python and it is in the Python section ;-)

That'll be the bit not working
In Jessie in years gone by you could install
python3-mosquitto with apt
With stretch it vanished as far as I know, so apt doesn't have it.
With Buster+ it'll be back again but as
python3-paho-mqtt from what I can see.

If you look through the link that was being followed every method including apt for installing the client is there, that will.have worked.
The only part that isn't is using pip3 to get MQTT for Python3, something that's needed on the Pi.

It'll probably be working if the instructions were followed and Python2* was being used.



At least that was my take on it, hence no comment on the apt or apt-get part.

But Matt's put the full method :-)



* It's 2019 so we don't want to be using that.

DirkS
Posts: 9872
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: MQTT and Python in 2019

Thu Jan 17, 2019 12:26 pm

bensimmo wrote:
Thu Jan 17, 2019 12:21 pm
DirkS wrote:
Wed Jan 16, 2019 9:41 pm
bensimmo wrote:
Wed Jan 16, 2019 8:14 pm
sudo pip3 install paho-mqtt
For Python3 since it's 2019
That doesn't install mosquitto, just the Python module to send / receive MQTT messages.
Has been like that for several years and still the case in 2019...
And the title of the topic is MQTT and Python and it is in the Python section ;-)
Well, all through the top post OP does not mention Python, just problems with installing mosquitto.
Also, the mention of files not appearing in /etc indicates mosquitto, not paho-mqtt
So your answer was incomplete, to say the least.

PhatFil
Posts: 1308
Joined: Thu Apr 13, 2017 3:55 pm
Location: Oxford UK

Re: MQTT and Python in 2019

Thu Jan 17, 2019 2:56 pm

mattmiller wrote:
Wed Jan 16, 2019 9:37 pm
The "trick" with installing mosquitto on a Pi is to ignore everything on T'internet and start with fresh Raspbian install and simply type in

Code: Select all

sudo apt-get install mosquitto mosquitto-clients
which will install and run a mosquitto broker service on your Pi listening out on port 1883

If you want to write some code in python then

Code: Select all

sudo pip install paho-mqtt 
The last time I did personally this was back in Nov 2018 so technically it might be broken in 2019 but I'd wage £5 it still works
+1

This is my experience too.

prwiley
Posts: 11
Joined: Tue Jun 19, 2018 2:08 pm
Location: Pennsylvania USA

Re: MQTT and Python in 2019

Thu Jan 17, 2019 4:13 pm

mattmiller wrote:
Wed Jan 16, 2019 9:37 pm
The "trick" with installing mosquitto on a Pi is to ignore everything on T'internet and start with fresh Raspbian install and simply type in

Code: Select all

sudo apt-get install mosquitto mosquitto-clients
which will install and run a mosquitto broker service on your Pi listening out on port 1883

If you want to write some code in python then

Code: Select all

sudo pip install paho-mqtt 
The last time I did personally this was back in Nov 2018 so technically it might be broken in 2019 but I'd wage £5 it still works
This is what ultimately worked. Thanks.

About 2019 . . . if one reads through posts on this forum re problems installing mosquitto the last ones, e.g. the most current, seem to be in mid/late 2018 and discuss stretch installation (used in the instructions I was following) being broken and requiring a fix and that fix was requested and was being waited on. I was hoping that, by 2019, a fix had been made. That does not seem to be the case since it certainly failed when I tried it.

And yeah, I probably posted my question in the wrong place.

Good luck with Brexit.

mattmiller
Posts: 2079
Joined: Thu Feb 05, 2015 11:25 pm

Re: MQTT and Python in 2019

Thu Jan 17, 2019 9:54 pm

Good luck with Brexit.
Same to you with Trump :)

Return to “Python”