Page 1 of 1

Tuya plugin PYTUYA no longer working

Posted: Tuesday 24 February 2026 15:20
by PatrickH67
Hi all,

I am using for years "pytuya" pluging to get access to TUYA device on local network on my Raspberry PI 3 running Domoticz 2022.1 version under "Buster" OS
I have now decided to install the last version of Domoticz 2025.2 on a new Raspberry PI5 running "Trixie"

Domoticz is running fine but I am no longer able to install the plugin "pytuya" on this OS. I have uses VENV on this install but even with this configuration I am not able to install it

I have the following message

Code: Select all

(Domoticz_Python_Environment) admin@pi5max:~/domoticz/plugins $ pip install pytuya
Collecting pytuya
  Using cached pytuya-7.0.6.zip (11 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [33 lines of output]
      Traceback (most recent call last):
        File "/tmp/pip-install-ci6a3pgy/pytuya_345f75310712492fbb5ef8fec14e281a/pytuya/__init__.py", line 24, in <module>
          import Crypto
     [ ModuleNotFoundError: No module named 'Crypto'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "/home/admin/Domoticz_Python_Environment/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
          main()
          ~~~~^^
        File "/home/admin/Domoticz_Python_Environment/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
          json_out["return_val"] = hook(**hook_input["kwargs"])
                                   ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
        File "/home/admin/Domoticz_Python_Environment/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-2xre7gbv/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 333, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=[])
                 ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-2xre7gbv/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires
          self.run_setup()
          ~~~~~~~~~~~~~~^^
        File "/tmp/pip-build-env-2xre7gbv/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 520, in run_setup
          super().run_setup(setup_script=setup_script)
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/tmp/pip-build-env-2xre7gbv/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 317, in run_setup
          exec(code, locals())
          ~~~~^^^^^^^^^^^^^^^^
        File "<string>", line 9, in <module>
        File "/tmp/pip-install-ci6a3pgy/pytuya_345f75310712492fbb5ef8fec14e281a/pytuya/__init__.py", line 28, in <module>
          import pyaes  # https://github.com/ricmoo/pyaes
          ^^^^^^^^^^^^
      ModuleNotFoundError: No module named 'pyaes'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed to build 'pytuya' when getting requirements to build wheel
As far as I can understand it cannot found module "Crypo" and "pyaes", but if list the install modules they are present

Code: Select all

(Domoticz_Python_Environment) admin@pi5max:~/domoticz/plugins $ pip list
Package            Version
------------------ --------
certifi            2026.1.4
cffi               2.0.0
charset-normalizer 3.4.4
colorama           0.4.6
crypto             1.4.1
cryptography       46.0.5
distlib            0.4.0
filelock           3.24.0
idna               3.11
Naked              0.1.32
packaging          26.0
pip                26.0.1
pipenv             2026.0.3
platformdirs       4.9.1
pyaes              1.6.1
pycparser          3.0
pycrypto           2.6.1
pycryptodome       3.23.0
PyYAML             6.0.3
requests           2.32.5
setuptools         82.0.0
shellescape        3.8.1
tinytuya           1.17.4
tuyapower          0.2.0
urllib3            2.6.3
virtualenv         20.36.1
wheel              0.46.3
On domotcz startup (/etc/init.d/domoticz.sh) I have added the VENV environment

Code: Select all

export PYTHONPATH=/home/admin/Domoticz_Python_Environment:$PYTONPATH
Any advice for solving this issue ?

Thanks
Patrick