paho.mqtt.python icon indicating copy to clipboard operation
paho.mqtt.python copied to clipboard

Not able to install in linux server

Open SIVAPRAS329 opened this issue 10 months ago • 3 comments

I have downloaded the package and unzipped. using pip3 install to install the package. getting error setup.py not found.

SIVAPRAS329 avatar Apr 26 '24 19:04 SIVAPRAS329

I can not reproduce. You need to provide detail if you want an answer.

PierreF avatar Apr 27 '24 06:04 PierreF

Dear @PierreF here is some more context: Raspian, Python 3.7, Installation via pip3 seems to work but import fails even so the package is installed on the right place and looks ok.

pi@rp:~/checkonline $ python3 checkonline.py 
Traceback (most recent call last):
  File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 49, in <module>
    from typing import Literal
ImportError: cannot import name 'Literal' from 'typing' (/usr/lib/python3.7/typing.py)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "checkonline.py", line 4, in <module>
    import paho.mqtt.client as mqtt
  File "/home/pi/.local/lib/python3.7/site-packages/paho/mqtt/client.py", line 51, in <module>
    from typing_extensions import Literal  # type: ignore
ModuleNotFoundError: No module named 'typing_extensions'

paho/mqtt/client.py Line49,51:

...
try:
    from typing import Literal
except ImportError:
    from typing_extensions import Literal  # type: ignore

if TYPE_CHECKING:
    try:
        from typing import TypedDict  # type: ignore
    except ImportError:
        from typing_extensions import TypedDict
...
pi@rp:~/checkonline $ pip3 freeze
asn1crypto==0.24.0
attrs==19.3.0
bcrypt==3.1.7
cached-property==1.5.1
certifi==2018.8.24
cffi==1.14.0
chardet==3.0.4
cryptography==2.6.1
distro==1.5.0
docker==4.2.1
docker-compose==1.26.0
dockerpty==0.4.1
docopt==0.6.2
entrypoints==0.3
idna==2.6
importlib-metadata==1.6.0
jsonschema==3.2.0
keyring==17.1.1
keyrings.alt==3.1.1
mysql-connector-python==8.0.33
paho-mqtt==2.1.0
paramiko==2.7.1
protobuf==3.20.3
pycparser==2.20
pycrypto==2.6.1
PyGObject==3.30.4
PyNaCl==1.4.0
pyrsistent==0.16.0
python-apt==1.8.4.3
python-dotenv==0.13.0
pyxdg==0.25
PyYAML==5.3.1
requests==2.21.0
SecretStorage==2.3.1
six==1.12.0
ssh-import-id==5.7
texttable==1.6.2
typing==3.7.4.3
urllib3==1.24.1
websocket-client==0.57.0
zipp==3.1.0

To fix this I tried to install from source like the README.md explains:

pi@rp:~/.local/lib/python3.7/site-packages $ git clone https://github.com/eclipse/paho.mqtt.python
Klone nach 'paho.mqtt.python' ...
remote: Enumerating objects: 6053, done.
remote: Counting objects: 100% (2243/2243), done.
remote: Compressing objects: 100% (625/625), done.
remote: Total 6053 (delta 1688), reused 1938 (delta 1529), pack-reused 3810
Empfange Objekte: 100% (6053/6053), 1.64 MiB | 2.00 MiB/s, Fertig.
Löse Unterschiede auf: 100% (3410/3410), Fertig.

pi@rp:~/.local/lib/python3.7/site-packages $ cd paho.mqtt.python

pi@rp:~/.local/lib/python3.7/site-packages/paho.mqtt.python $ pip3 install -e .
Directory '.' is not installable. File 'setup.py' not found.

fah avatar Jul 10 '24 09:07 fah

I encountered No module named 'typing_extensions' whilst testing another issue . Fixed by running pip install typing_extensions (sorry, not really a solution but may help others work around this). Note that I think the issue initially raised is a different problem.

MattBrittan avatar Jul 17 '24 23:07 MattBrittan