linuxserver/docker-homeassistant

pyrate-limiter install issue

retrov opened this issue · 10 comments

In one of the later builds of this container it seems like some of the Python dev tools are missing.
One of my addons is trying to install the pyrate-limiter and hits an issue.
Tried manually with pip "install pyrate-limiter" and it fails

            gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-x86_64-cpython-39/c/_cffi_backend.o
            error: command 'gcc' failed: No such file or directory
            [end of output]
      

This worked in the past. Any insights?

Thanks for opening your first issue here! Be sure to follow the bug or feature issue templates!

Our container never included python dev tools. We ship all addons' python packages preinstalled (done in build stage). But HA sometimes disables packages in their requirements files (no idea why). So we have to manually add them back in.

Which addon is that?

Ah, yeah. That's not a built-in HA addon. IT's a separate 3rd party one.

You'll have to manually install it.
You can create a custom script that first installs python dev tools with apk add --no-cache python3-dev py3-pip g++ and then do your pip install . . .
Here's more info on custom scripts: https://www.linuxserver.io/blog/2019-09-14-customizing-our-containers#custom-scripts

Thanks, tried it but seems to be a bit more of an issue. And a bit outside what I'm capable of tracking down the root cause.
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -fomit-frame-pointer -g -fno-semantic-interposition -DTHREAD_STACK_SIZE=0x100000 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.9 -c c/_cffi_backend.c -o build/temp.linux-x86_64-cpython-39/c/_cffi_backend.o c/_cffi_backend.c:15:10: fatal error: ffi.h: No such file or directory 15 | #include <ffi.h> | ^~~~~~~ compilation terminated. error: command '/usr/bin/gcc' failed with exit code 1

I just exec'ed into the running container and ran these steps:
apk add --no-cache python3-dev py3-pip g++
and then
pip install --no-cache-dir pytz volkswagencarnet==4.4.53
and done

Requirement already satisfied: pytz in /usr/lib/python3.9/site-packages (2022.1)
Collecting volkswagencarnet==4.4.53
  Downloading volkswagencarnet-4.4.53-py3-none-any.whl (52 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 52.6/52.6 KB 1.2 MB/s eta 0:00:00
Requirement already satisfied: beautifulsoup4 in /usr/lib/python3.9/site-packages (from volkswagencarnet==4.4.53) (4.10.0)
Requirement already satisfied: lxml in /usr/lib/python3.9/site-packages (from volkswagencarnet==4.4.53) (4.8.0)
Requirement already satisfied: pyjwt in /usr/lib/python3.9/site-packages (from volkswagencarnet==4.4.53) (2.3.0)
Requirement already satisfied: aiohttp in /usr/lib/python3.9/site-packages (from volkswagencarnet==4.4.53) (3.8.1)
Requirement already satisfied: charset-normalizer<3.0,>=2.0 in /usr/lib/python3.9/site-packages (from aiohttp->volkswagencarnet==4.4.53) (2.0.12)
Requirement already satisfied: attrs>=17.3.0 in /usr/lib/python3.9/site-packages (from aiohttp->volkswagencarnet==4.4.53) (21.2.0)
Requirement already satisfied: aiosignal>=1.1.2 in /usr/lib/python3.9/site-packages (from aiohttp->volkswagencarnet==4.4.53) (1.2.0)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/lib/python3.9/site-packages (from aiohttp->volkswagencarnet==4.4.53) (1.7.2)
Requirement already satisfied: multidict<7.0,>=4.5 in /usr/lib/python3.9/site-packages (from aiohttp->volkswagencarnet==4.4.53) (6.0.2)
Requirement already satisfied: async-timeout<5.0,>=4.0.0a3 in /usr/lib/python3.9/site-packages (from aiohttp->volkswagencarnet==4.4.53) (4.0.2)
Requirement already satisfied: frozenlist>=1.1.1 in /usr/lib/python3.9/site-packages (from aiohttp->volkswagencarnet==4.4.53) (1.3.0)
Requirement already satisfied: soupsieve>1.2 in /usr/lib/python3.9/site-packages (from beautifulsoup4->volkswagencarnet==4.4.53) (2.3.2.post1)
Requirement already satisfied: idna>=2.0 in /usr/lib/python3.9/site-packages (from yarl<2.0,>=1.0->aiohttp->volkswagencarnet==4.4.53) (3.2)
Installing collected packages: volkswagencarnet
Successfully installed volkswagencarnet-4.4.53
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv

Yes, that part works fine. But when you then try to add and configure the component via the UI: Configuration > Integrations > search for "Volkswagen We Connect" and follow the wizard to configure.
It fails due to the missing pyrate-limiter
homeassistant.requirements.RequirementsNotFound: Requirements for volkswagencarnet not found: ['pyrate-limiter>=2.8.0'].

Which fails with the errors above.

also install the alpine package libffi-dev
so change the first command to apk add --no-cache python3-dev py3-pip g++ libffi-dev

So when I checked the manifest.json file after it was installed through the HACS interface.
I could see that the pyrate-limiter requirements was added even though it´s not in the requirements as you pointed out.
I removed it manually and it finally worked when I tried to configure the service integration.

Thanks for your help.

{
    "codeowners": [
        "@robinostlund"
    ],
    "config_flow": true,
    "dependencies": [],
    "documentation": "https://github.com/robinostlund/homeassistant-volkswagencarnet/blob/master/README.md",
    "domain": "volkswagencarnet",
    "iot_class": "cloud_polling",
    "issue_tracker": "https://github.com/robinostlund/homeassistant-volkswagencarnet/issues",
    "name": "Volkswagen WeConnect",
    "requirements": [
        "pytz",
        "volkswagencarnet==4.4.57"
    ],
    "version": "v4.4.59-beta.7"
}