jasonacox / tinytuya

Python API for Tuya WiFi smart devices using a direct local area network (LAN) connection or the cloud (TuyaCloud API).
MIT License
867 stars 157 forks source link

Installing inside docker #457

Open varazir opened 4 months ago

varazir commented 4 months ago

Hello, I'm running Domoticz inside a docker installation and I need to this module installed. I tried to use the custom.sh startup script but it didn't install it. So I tried it using a docker bash session and I keep getting a loop error when installing it

  Using cached cryptography-41.0.6.tar.gz (630 kB)
  Installing build dependencies ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/lib/python3/dist-packages/pip install --ignore-installed --no-user --prefix /tmp/pip-build-env-y192d1_q/overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- 'setuptools>=61.0.0' wheel 'cffi>=1.12; platform_python_implementation != '"'"'PyPy'"'"'' 'setuptools-rust>=0.11.4'
       cwd: None

The whole error https://gist.github.com/varazir/7a39293f14a98430468fa72c9c940049

jasonacox commented 4 months ago

This might help:

# Test container
docker run -it --rm -p 6666:6666/udp -p 6667:6667/udp -p 7000:7000/udp -v $(pwd):/app --name tinytuya-cli jasonacox/tinytuya-cli:latest

Example Dockerfile: https://github.com/jasonacox/tinytuya/blob/master/examples/Dockerfile

varazir commented 4 months ago

the docker image was missing this libffi-dev build-essential pkg-config libssl-dev

varazir commented 4 months ago

it worked running this pip3 install cryptography==3.1.1 requests==2.23.0 charset-normalizer==3.0.1 tinytuya -U

jasonacox commented 4 months ago

Would you be willing to share you Dockerfile? I'll update the repo, or you can submit a PR.

Thanks!

varazir commented 4 months ago

Would you be willing to share you Dockerfile? I'll update the repo, or you can submit a PR.

Thanks!

The file is from here https://hub.docker.com/r/domoticz/domoticz as I said it's not your docker so I guess it's a bit out of scope for you. But a FAQ if someone are trying to install and they get error like this you need the this pkg's.