home-assistant-libs / pytradfri

IKEA Trådfri/Tradfri API. Control and observe your lights from Python. Examples available. On pypi. Sans-io.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Build error when installing pytradfri[async]==7.0.4 on Python 3.9 / Ubuntu 20.04.1 LTS

StevenLooman opened this issue · comments

Where are you using pytradfri (eg stand-alone, Home Assistant etc)

Home Assistant

Version of pytradfri

7.0.4

Backend used (aiocoap, libcoap)

libcoap2

Expected behaviour

pytradfri is installed.

Actual behaviour

Installation fails due to GCC compiler errors:

2020-12-20 21:41:39 ERROR (SyncWorker_1) [homeassistant.util.package] Unable to install package pytradfri[async]==7.0.4: ERROR: Command errored out with exit status 1:
   command: /home/steven/src/python/home-assistant/.venv/bin/python /home/steven/src/python/home-assistant/.venv/lib/python3.9/site-packages/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpsazc1kga
       cwd: /tmp/pip-install-5rtauuxl/dtlssocket_b4a52ec0b87c4a17b45f64c6063c1426
  Complete output (237 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-3.9
  creating build/lib.linux-x86_64-3.9/DTLSSocket
  copying DTLSSocket/__init__.py -> build/lib.linux-x86_64-3.9/DTLSSocket
  copying DTLSSocket/DTLSSocket.py -> build/lib.linux-x86_64-3.9/DTLSSocket
  running build_ext
  checking for doxygen... :
  checking for etags... /bin/false
  checking whether make sets $(MAKE)... yes
  checking for gcc... gcc
  checking whether the C compiler works... yes
  checking for C compiler default output file name... a.out
  checking for suffix of executables...
  checking whether we are cross compiling... no
  checking for suffix of object files... o
  checking whether we are using the GNU C compiler... yes
  checking whether gcc accepts -g... yes
  checking for gcc option to accept ISO C89... none needed
  checking for ranlib... ranlib
  checking how to run the C preprocessor... gcc -E
  checking for grep that handles long lines and -e... /usr/bin/grep
  checking for egrep... /usr/bin/grep -E
  checking for ANSI C header files... yes
  checking for sys/types.h... yes
  checking for sys/stat.h... yes
  checking for stdlib.h... yes
  checking for string.h... yes
  checking for memory.h... yes
  checking for strings.h... yes
  checking for inttypes.h... yes
  checking for stdint.h... yes
  checking for unistd.h... yes
  checking whether byte ordering is bigendian... no
  checking for library containing gethostbyname... none required
  checking for library containing socket... none required
  checking assert.h usability... yes
  checking assert.h presence... yes
  checking for assert.h... yes
  checking arpa/inet.h usability... yes
  checking arpa/inet.h presence... yes
  checking for arpa/inet.h... yes
  checking fcntl.h usability... yes
  checking fcntl.h presence... yes
  checking for fcntl.h... yes
  checking for inttypes.h... (cached) yes
  checking netdb.h usability... yes
  checking netdb.h presence... yes
  checking for netdb.h... yes
  checking netinet/in.h usability... yes
  checking netinet/in.h presence... yes
  checking for netinet/in.h... yes
  checking stddef.h usability... yes
  checking stddef.h presence... yes
  checking for stddef.h... yes
  checking for stdint.h... (cached) yes
  checking for stdlib.h... (cached) yes
  checking for string.h... (cached) yes
  checking for strings.h... (cached) yes
  checking sys/param.h usability... yes
  checking sys/param.h presence... yes
  checking for sys/param.h... yes
  checking sys/socket.h usability... yes
  checking sys/socket.h presence... yes
  checking for sys/socket.h... yes
  checking for unistd.h... (cached) yes
  checking sys/time.h usability... yes
  checking sys/time.h presence... yes
  checking for sys/time.h... yes
  checking time.h usability... yes
  checking time.h presence... yes
  checking for time.h... yes
  checking for sys/types.h... (cached) yes
  checking for sys/stat.h... (cached) yes
  checking for inline... inline
  checking for size_t... yes
  checking for struct sockaddr_in6.sin6_len... no
  checking for memset... yes
  checking for select... yes
  checking for socket... yes
  checking for strdup... yes
  checking for strerror... yes
  checking for strnlen... yes
  checking for fls... no
  checking for vprintf... yes
  configure: creating ./config.status
  config.status: creating Makefile
  config.status: creating doc/Makefile
  config.status: creating doc/Doxyfile
  config.status: creating tests/Makefile
  config.status: creating platform-specific/Makefile
  config.status: creating sha2/Makefile
  config.status: creating aes/Makefile
  config.status: creating ecc/Makefile
  config.status: creating dtls_config.h
  config.status: dtls_config.h is unchanged
  Running: autoconf
  Running: autoheader
  Running: ./configure --without-ecc
  skipping 'DTLSSocket/dtls.c' Cython extension (up-to-date)
  building 'DTLSSocket.dtls' extension
  creating build/temp.linux-x86_64-3.9
  creating build/temp.linux-x86_64-3.9/DTLSSocket
  creating build/temp.linux-x86_64-3.9/DTLSSocket/tinydtls
  creating build/temp.linux-x86_64-3.9/DTLSSocket/tinydtls/aes
  creating build/temp.linux-x86_64-3.9/DTLSSocket/tinydtls/platform-specific
  creating build/temp.linux-x86_64-3.9/DTLSSocket/tinydtls/sha2
  x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DDTLSv12=1 -DWITH_SHA256=1 -DDTLS_CHECK_CONTENTTYPE=1 -D_GNU_SOURCE=1 -DNDEBUG=1 -IDTLSSocket/tinydtls -I/home/steven/src/python/home-assistant/.venv/include -I/usr/include/python3.9 -c DTLSSocket/dtls.c -o build/temp.linux-x86_64-3.9/DTLSSocket/dtls.o
  DTLSSocket/dtls.c: In function ‘__pyx_f_10DTLSSocket_4dtls__get_psk_info’:
  DTLSSocket/dtls.c:2583:41: warning: comparison of integer expressions of different signedness: ‘size_t’ {aka ‘long unsigned int’} and ‘Py_ssize_t’ {aka ‘long int’} [-Wsign-compare]
   2583 |     __pyx_t_4 = ((__pyx_v_result_length >= __pyx_v_l) != 0);
        |                                         ^~
  DTLSSocket/dtls.c: In function ‘PyInit_dtls’:
  DTLSSocket/dtls.c:7620:40: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
   7620 |   __pyx_type_10DTLSSocket_4dtls_Session.tp_print = 0;
        |                                        ^
  DTLSSocket/dtls.c:7629:43: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
   7629 |   __pyx_type_10DTLSSocket_4dtls_Connection.tp_print = 0;
        |                                           ^
  DTLSSocket/dtls.c:7638:45: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
   7638 |   __pyx_type_10DTLSSocket_4dtls_MCConnection.tp_print = 0;
        |                                             ^
  DTLSSocket/dtls.c:7644:37: error: ‘PyTypeObject’ {aka ‘struct _typeobject’} has no member named ‘tp_print’
   7644 |   __pyx_type_10DTLSSocket_4dtls_DTLS.tp_print = 0;
        |                                     ^
  DTLSSocket/dtls.c: In function ‘__Pyx_ParseOptionalKeywords’:
  DTLSSocket/dtls.c:8270:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
   8270 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                     ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
    446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
        |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8270:21: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
   8270 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                     ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
    580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
        |                                             ^~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8270:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
   8270 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                     ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
    446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
        |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8270:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
   8270 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                     ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
    446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
        |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8270:21: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
   8270 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                     ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
    580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
        |                                             ^~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8270:21: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
   8270 |                     (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                     ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
    446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
        |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8286:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
   8286 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                         ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
    446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
        |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8286:25: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
   8286 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                         ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
    580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
        |                                             ^~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8286:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
   8286 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                         ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
    446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
        |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8286:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
   8286 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                         ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
    446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
        |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8286:25: warning: ‘PyUnicode_AsUnicode’ is deprecated [-Wdeprecated-declarations]
   8286 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                         ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:580:45: note: declared here
    580 | Py_DEPRECATED(3.3) PyAPI_FUNC(Py_UNICODE *) PyUnicode_AsUnicode(
        |                                             ^~~~~~~~~~~~~~~~~~~
  DTLSSocket/dtls.c:8286:25: warning: ‘_PyUnicode_get_wstr_length’ is deprecated [-Wdeprecated-declarations]
   8286 |                         (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 :
        |                         ^
  In file included from /usr/include/python3.9/unicodeobject.h:1026,
                   from /usr/include/python3.9/Python.h:97,
                   from DTLSSocket/dtls.c:61:
  /usr/include/python3.9/cpython/unicodeobject.h:446:26: note: declared here
    446 | static inline Py_ssize_t _PyUnicode_get_wstr_length(PyObject *op) {
        |                          ^~~~~~~~~~~~~~~~~~~~~~~~~~
  error: command '/usr/bin/x86_64-linux-gnu-gcc' failed with exit code 1
  ----------------------------------------
  ERROR: Failed building wheel for DTLSSocket
ERROR: Could not build wheels for DTLSSocket which use PEP 517 and cannot be installed directly
2020-12-20 21:41:39 ERROR (MainThread) [homeassistant] Error doing job: Task exception was never retrieved
Traceback (most recent call last):
  File "/home/steven/src/python/home-assistant/homeassistant/data_entry_flow.py", line 119, in async_init
    flow = await self.async_create_flow(handler, context=context, data=data)
  File "/home/steven/src/python/home-assistant/homeassistant/config_entries.py", line 532, in async_create_flow
    await async_process_deps_reqs(self.hass, self._hass_config, integration)
  File "/home/steven/src/python/home-assistant/homeassistant/setup.py", line 343, in async_process_deps_reqs
    await requirements.async_get_integration_with_requirements(
  File "/home/steven/src/python/home-assistant/homeassistant/requirements.py", line 74, in async_get_integration_with_requirements
    await async_process_requirements(
  File "/home/steven/src/python/home-assistant/homeassistant/requirements.py", line 131, in async_process_requirements
    raise RequirementsNotFound(name, [req])
homeassistant.requirements.RequirementsNotFound: Requirements for tradfri not found: ['pytradfri[async]==7.0.4'].

Possible fix

I think upgrading DTLSSocket to 0.1.12 fixes this issue, as per mclab-hbrs/DTLSSocket#3

PyPI does have version DTLSSocket==0.1.2, but I don't see any related commits on GitLab GitHub. I'll check with kabel42.

That commit is just the version bump. What changed from 0.1.11 in terms of code?

There are apparently no source changes needed, just a clean build:
mclab-hbrs/DTLSSocket#3 (comment)

@StevenLooman do you want to make a PR and bump DTLSSocket?

Sure.

Please correct me if I'm wrong but I think DTLSSocket version bump is not in 7.0.5. Can I somehow force my home assistant to pull this update or do I have to wait for 7.0.6? Thank you!

We need to release a new version.

I'll release a new version.

Will this still come to homeassistant 2021.1? 2021.1.0b3 seems to still use the old version.
I recently updated and can't use my lights anymore...

As a temporary workaround I have manually edited my components/tradfri/manifest.json to refer to the recent version of pytradfri:

"requirements": ["pytradfri[async]==7.0.6"]

home-assistant/core#44661 updates to 7.0.6, should land in Home Assistant 2021.1.0