Cffi error stops upgrading on several Pi's

I have regular installs on seven Pi’s (not Docker because HA is integrated with other stuff on the Pi), and I tried to do an upgrade to the latest version. But they all say the same, can anybody help me out with what I need to do here? It says a lot of adding directories to a variable, but I think the whole thing should work automatic with the ```
pip3 install --upgrade homeassistant


    Collecting pycparser (from cffi!=1.11.3,>=1.8->cryptography==2.5->homeassistant)
  Using cached https://www.piwheels.org/simple/pycparser/pycparser-2.19-py2.py3-none-any.whl
Building wheels for collected packages: cffi
  Running setup.py bdist_wheel for cffi ... error
  Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zl92_0cc/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" bdist_wheel -d /tmp/tmpfre7pglzpip-wheel- --python-tag cp35:
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  Package libffi was not found in the pkg-config search path.
  Perhaps you should add the directory containing `libffi.pc'
  to the PKG_CONFIG_PATH environment variable
  No package 'libffi' found
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-armv7l-3.5
  creating build/lib.linux-armv7l-3.5/cffi
  copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/error.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/recompiler.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/lock.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/cparser.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/api.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/commontypes.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/verifier.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/__init__.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/model.py -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/_embedding.h -> build/lib.linux-armv7l-3.5/cffi
  copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.5/cffi
  running build_ext
  building '_cffi_backend' extension
  creating build/temp.linux-armv7l-3.5
  creating build/temp.linux-armv7l-3.5/c
  arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-6waWnr/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.5/c/_cffi_backend.o
  c/_cffi_backend.c:15:17: fatal error: ffi.h: Ingen slik fil eller filkatalog
   #include <ffi.h>
                   ^
  compilation terminated.
  error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
  
  ----------------------------------------
  Failed building wheel for cffi
  Running setup.py clean for cffi
Failed to build cffi
Installing collected packages: pip, PyJWT, async-timeout, Unidecode, python-slugify, pytz, voluptuous, certifi, astral, attrs, asn1crypto, pycparser, cffi, six, cryptography, pyyaml, ruamel.yaml, idna, chardet, urllib3, requests, voluptuous-serialize, bcrypt, MarkupSafe, jinja2, typing-extensions, multidict, yarl, idna-ssl, aiohttp, homeassistant
  Running setup.py install for cffi ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zl92_0cc/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vxq0fgdp-record/install-record.txt --single-version-externally-managed --compile --user --prefix=:
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    Package libffi was not found in the pkg-config search path.
    Perhaps you should add the directory containing `libffi.pc'
    to the PKG_CONFIG_PATH environment variable
    No package 'libffi' found
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.5
    creating build/lib.linux-armv7l-3.5/cffi
    copying cffi/backend_ctypes.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/error.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/pkgconfig.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/setuptools_ext.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/recompiler.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/lock.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/vengine_cpy.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/vengine_gen.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/cparser.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/api.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/ffiplatform.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/commontypes.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/cffi_opcode.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/verifier.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/__init__.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/model.py -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/_cffi_include.h -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/parse_c_type.h -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/_embedding.h -> build/lib.linux-armv7l-3.5/cffi
    copying cffi/_cffi_errors.h -> build/lib.linux-armv7l-3.5/cffi
    running build_ext
    building '_cffi_backend' extension
    creating build/temp.linux-armv7l-3.5
    creating build/temp.linux-armv7l-3.5/c
    arm-linux-gnueabihf-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fdebug-prefix-map=/build/python3.5-6waWnr/python3.5-3.5.3=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python3.5m -c c/_cffi_backend.c -o build/temp.linux-armv7l-3.5/c/_cffi_backend.o
    c/_cffi_backend.c:15:17: fatal error: ffi.h: Ingen slik fil eller filkatalog
     #include <ffi.h>
                     ^
    compilation terminated.
    error: command 'arm-linux-gnueabihf-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-zl92_0cc/cffi/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-vxq0fgdp-record/install-record.txt --single-version-externally-managed --compile --user --prefix=" failed with error code 1 in /tmp/pip-build-zl92_0cc/cffi/

Try apt-get install libffi-dev

It appears to me the devs are focusing on Docker & Hassio builds and Hassbian images. They can then control dependencies.

Thanks! I didn’t get an error message this time! :slight_smile: But the version is still 0.80.2. Should’nt it be higher? in my “Update Available” message it says 0.91.4.

Edit: The “Update Available” message dissappears after the update, even if it still says 0.80.2 as the version.

0.91.4 is the current version. Try a reboot?

Right. So why isn’t HA showing that after the pip3 install --upgrade homeassistant

And this is on five different Pi’s! After restart of HA and everything.

Not showing or wrong version?
I am assuming you are in the Python venv when installing.

It’s not showing the right version. And I have no idea what a venv is, I have just followed the instructions that came up when I clicked on the cloud showing the new version:

The default way to update Home Assistant to the latest release, when available, is:

$ pip3 install --upgrade homeassistant

Edit: Virtual environment, OK. DOes that mean I should run that as the homeassistant user, not pi? If that’s the case, I wish it had said so…

Edit 2: Is this where I do the Star Wars joke, “You assume too much”? :rofl:

Here is the official way.

$ sudo -u homeassistant -H -s
$ source /srv/homeassistant/bin/activate
$ pip3 install --upgrade homeassistant

or now try

$ sudo -u homeassistant -H -s
$ source /srv/homeassistant/bin/activate
$ pip3 install homeassistant==0.91.4

From

Thanks! This time it worked. Maybe that should have been linked in the page users get up when they click the cloud showing an update being ready. Also, is there a whole other installation somewhere now, with the commands I issued from outside the virtual environment, that I need to get rid of?

You could do pip3 uninstall homeassistant

Great, thanks again! :slight_smile:

1 Like

I have the same problem as Mastiff… upgraded to .92 (via pip3) but it shows the old (.81) version instead. If I want to remove the not working upgrade and do it again is it correct to do pip3 uninstall homeassistant==0.92 and then a new upgrade as written above?

Thanks for the info. Had the same problem when upgrading from 0.91.4, but " apt-get install libffi-dev" worked for me