3

I try to install Flask-Bcrypt on Raspbian to hash passwords in my Flask application, but I get this error:

Searching for flask-bcrypt
Best match: Flask-Bcrypt 0.7.1
Flask-Bcrypt 0.7.1 is already the active version in easy-install.pth

Using /usr/local/lib/python2.7/dist-packages
Processing dependencies for flask-bcrypt
Searching for bcrypt
Reading http://pypi.python.org/simple/bcrypt/
Best match: bcrypt 2.0.0
Downloading https://pypi.python.org/packages/source/b/bcrypt/bcrypt-2.0.0.tar.gz#md5=e7fb17be46904cdb2ae6a062859ee58c
Processing bcrypt-2.0.0.tar.gz
Running bcrypt-2.0.0/setup.py -q bdist_egg --dist-dir /tmp/easy_install-EkuzN4/bcrypt-2.0.0/egg-dist-tmp-bQofuP
Checking .pth file support in .
/usr/bin/python -E -c pass
Searching for cffi>=1.1
Reading http://pypi.python.org/simple/cffi/
Best match: cffi 1.2.1
Downloading https://pypi.python.org/packages/source/c/cffi/cffi-1.2.1.tar.gz#md5=faca1e420e80433db409bb1bdd0a3f45
Processing cffi-1.2.1.tar.gz
Running cffi-1.2.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-EkuzN4/bcrypt-2.0.0/temp/easy_install-eyecOZ/cffi-1.2.1/egg-dist-tmp-ismXiX
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
compiling '_configtest.c':
__thread int some_threadlocal_variable_42;

gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -c _configtest.c -o _configtest.o
success!
removing: _configtest.c _configtest.o
c/_cffi_backend.c:13:17: fatal error: ffi.h: Aucun fichier ou dossier de ce type
compilation terminated.
error: Setup script exited with error: command 'gcc' failed with exit status 1

Can I add libffi? How? Should I use another library to hash passwords?

10

Python needs the native C lib installed. Since it is building against it, it also needs the development headers, which presuming you are using Raspbian or another Debian variant, come in -dev packages. These will pull in the library itself as a dependency if not installed.

This is from Raspbian 8 (aka. jessie):

> apt-cache search libffi | grep dev
libffi-dev - Foreign Function Interface library (development files)
libffindex0-dev - library for simple index/database for huge amounts of small files (development)
libffi5-dev - Foreign Function Interface library (development files)

There are your choices; presumably the middle one is unrelated. Since there's a libffi6 runtime, likely the non-5 dev is for that and 6 is the default. So I'd first try:

apt-get install libffi-dev
0

stretch doesn't seem to contain this by default, but I searched the debian repositories and they have versions compiled for armhf. I just downloaded libffi-dev for armhf and installed it manually with dpkg

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.