0

I have been using the paho-mqtt client successfully with python 2.7 on raspbian stretch, but I have a need to use python 3.5 on a new project and paho-mqtt does not appear to install or build for that version of python on raspbian stretch.

when I try to install via pip ...

(qt) pi@qacker:~ $ which python
/home/pi/berryconda3/envs/qt/bin/python

(qt) pi@qacker:~ $ python --version
Python 3.5.4

(qt) pi@qacker:~ $ pip install paho-mqtt
Traceback (most recent call last):
  File "/home/pi/berryconda3/envs/qt/bin/pip", line 4, in <module>
    import pip
  File "/usr/lib/python3/dist-packages/pip/__init__.py", line 26, in <module>
    from pip.utils import get_installed_distributions, get_prog
  File "/usr/lib/python3/dist-packages/pip/utils/__init__.py", line 30, in <module>
    from pip._vendor.retrying import retry
ImportError: No module named 'pip._vendor.retrying'

when I try to build ...

(qt) pi@qacker:~/bitsy_gen3/dev-tools/qacker/paho.mqtt.python $ python setup.py install
running install
Traceback (most recent call last):
  File "setup.py", line 56, in <module>
    setup_requires=setup_requirements
  File "/home/pi/berryconda3/envs/qt/lib/python3.5/distutils/core.py", line 148, in setup
    dist.run_commands()
  File "/home/pi/berryconda3/envs/qt/lib/python3.5/distutils/dist.py", line 955, in run_commands
    self.run_command(cmd)
  File "/home/pi/berryconda3/envs/qt/lib/python3.5/distutils/dist.py", line 974, in run_command
    cmd_obj.run()
  File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 67, in run
    self.do_egg_install()
  File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 103, in do_egg_install
    cmd.ensure_finalized()  # finalize before bdist_egg munges install cmd
  File "/home/pi/berryconda3/envs/qt/lib/python3.5/distutils/cmd.py", line 107, in ensure_finalized
    self.finalize_options()
  File "/usr/lib/python3/dist-packages/setuptools/command/easy_install.py", line 305, in finalize_options
    'install_lib', ('install_dir', 'install_dir')
  File "/home/pi/berryconda3/envs/qt/lib/python3.5/distutils/cmd.py", line 287, in set_undefined_options
    src_cmd_obj.ensure_finalized()
  File "/home/pi/berryconda3/envs/qt/lib/python3.5/distutils/cmd.py", line 107, in ensure_finalized
    self.finalize_options()
  File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 18, in finalize_options
    self.set_undefined_options('install',('install_layout','install_layout'))
  File "/home/pi/berryconda3/envs/qt/lib/python3.5/distutils/cmd.py", line 290, in set_undefined_options
    setattr(self, dst_option, getattr(src_cmd_obj, src_option))
  File "/home/pi/berryconda3/envs/qt/lib/python3.5/distutils/cmd.py", line 103, in __getattr__
    raise AttributeError(attr)
AttributeError: install_layout
  • If you have a valid answer, please accept it. It's the answer that I would have put down. – NomadMaker Jul 27 '18 at 8:57
1

Assuming you already have mosquito installed:

sudo apt-get install mosquitto
sudo apt-get install mosquitto-clients

For python3 use:

pip3 install paho-mqtt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.