AnjuT
AnjuT

Reputation: 176

Install package paho-mqtt

I am trying to install paho-mqtt package for my python project. But it gives the error

Error: Python packaging tool 'pip' not found. 

I am using ubuntu 16.04 and I am running this command

pip install paho-mqtt

Can anyone tell me is there another way to install this?

Upvotes: 0

Views: 16896

Answers (3)

Greg Woods
Greg Woods

Reputation: 2770

There is another relevant answer to the OP's question "is there another way to install this", which is that python packages such as paho.mqtt can be installed with the OS package manager, such as apt

Background

In 2024, attempting to run sudo apt install paho-mqtt will give the message:

error: externally-managed-environment

This post: How do I solve "error: externally-managed-environment" every time I use pip 3? explains that it is python feature designed to promote the use of virtual environments.

However, in some cases, such as running python in a docker container, it is a nuisance.

Solutions are

  1. Use a virtual environment. pipx can help with this
  2. Ignore the error with the pip option --break-system-packages
  3. Install the library using the system package manager. In this case...

sudo apt install python-paho-mqtt

Bear in mind though that the system package manager may not have access to the same version which you need. In my case apt installed 1.6.1-1, and I needed 2.0.0.

Upvotes: -1

Java dev
Java dev

Reputation: 535

Python uses pip to install various Python modules like request, jsonpickel etc.

So you need to install pip first as said by @Asoul

Upvotes: 0

Asoul
Asoul

Reputation: 1016

Install pip first, if using python2

sudo apt-get install python-pip

or for python3

sudo apt-get install python3-pip

Upvotes: 1

Related Questions