Installation of Ansible breaks on PyNaCl dependency.


Hi all,

I just want to inform you that the installation of Ansible (pip install ansible) breaks on a dependency called PyNaCl. PyNaCl depends on libffi headers (libffi-dev) but this package is not located in the Cumulus repositories.

"""
Downloading/unpacking pynacl>=1.0.1 (from paramiko->ansible) Downloading PyNaCl-1.1.2.tar.gz (3.1MB): 3.1MB downloaded
Running setup.py (path:/tmp/pip-build-1dfKza/pynacl/setup.py) egg_info for package pynacl
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
c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory #include
^
compilation terminated.
"""

# cat /etc/lsb-release
DISTRIB_ID="Cumulus Linux"
DISTRIB_RELEASE=3.3.2
DISTRIB_DESCRIPTION="Cumulus Linux 3.3.2"

To keep things simple, maybe it should be added?

Regards,
Michiel

2 replies

Userlevel 4
Ironically, I had just submitted an Enhancement request on this yesterday (CM-17327).

Until libffi-dev is added to the Jessie-supplemental repository you can use this approach, a bit cumbersome, but functional:
sudo su  # Add Debian Repo  cat << EOT > /etc/apt/sources.list.d/jessie.list  deb  http://deb.debian.org/debian jessie main  deb-src  http://deb.debian.org/debian jessie main  deb  http://deb.debian.org/debian jessie-updates main  deb-src  http://deb.debian.org/debian jessie-updates main  EOT  apt-get update -y && apt-get install python-pip python-dev build-essential libffi-dev libssl-dev -y  
pip install ansible==2.3.1.0

while trying to install Ansible, I hit a similar problem where python-cffi 0.8.2 was installed and i couldn't upgrade it. first removed cffi 0.8.2 then installed fresh cffi 1.11.0 (pynacl has requirement for a minimum version of cffi 1.0+ per https://pypi.python.org/pypi/PyNaCl/)

cffi doesn't upgrade
root@vagrant-ubuntu-trusty-64:/vagrant/NetOpsWorkshop/install# pip install -U cffi
Downloading/unpacking cffi from https://pypi.python.org/packages/4e/32/4070bdf32812c89eb635c80880a5caa2e0189aa7999994c265577e5154f3/...
Downloading cffi-1.11.0.tar.gz (434kB): 434kB downloaded
Running setup.py (path:/tmp/pip_build_root/cffi/setup.py) egg_info for package cffi
Downloading/unpacking pycparser from https://pypi.python.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/... (from cffi)
Downloading pycparser-2.18.tar.gz (245kB): 245kB downloaded
Running setup.py (path:/tmp/pip_build_root/pycparser/setup.py) egg_info for package pycparser
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
Installing collected packages: cffi, pycparser
Found existing installation: cffi 0.8.2
Not uninstalling cffi at /usr/lib/python2.7/dist-packages, owned by OS
Running setup.py install for cffi
building '_cffi_backend' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/usr/include/ffi -I/usr/include/libffi -I/usr/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2.7/c/_cffi_backend.o
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -D_FORTIFY_SOURCE=2 -g -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/c/_cffi_backend.o -lffi -o build/lib.linux-x86_64-2.7/_cffi_backend.so
Found existing installation: pycparser 2.10
Not uninstalling pycparser at /usr/lib/python2.7/dist-packages, owned by OS
Running setup.py install for pycparser
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
Build the lexing/parsing tables
Successfully installed cffi pycparser
Cleaning up...


remove cffi 0.8.2
root@vagrant-ubuntu-trusty-64:/vagrant/NetOpsWorkshop/install# apt-get --purge remove python-cffi
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
python-ply python-pycparser
Use 'apt-get autoremove' to remove them.
The following packages will be REMOVED:
python-cffi*
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 313 kB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 67558 files and directories currently installed.)
Removing python-cffi (0.8.2-0ubuntu1) ...
install cffi 1.11.0
root@vagrant-ubuntu-trusty-64:/vagrant/NetOpsWorkshop/install# pip install -U cffi
Requirement already up-to-date: cffi in /usr/local/lib/python2.7/dist-packages
Downloading/unpacking pycparser from https://pypi.python.org/packages/8c/2d/aad7f16146f4197a11f8e91fb81df177adcc2073d36a17b1491fd09df6ed/... (from cffi)
Downloading pycparser-2.18.tar.gz (245kB): 245kB downloaded
Running setup.py (path:/tmp/pip_build_root/pycparser/setup.py) egg_info for package pycparser
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
Installing collected packages: pycparser
Found existing installation: pycparser 2.10
Not uninstalling pycparser at /usr/lib/python2.7/dist-packages, owned by OS
Running setup.py install for pycparser
warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
warning: no previously-included files matching 'lextab.*' found under directory 'tests'
warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
warning: no previously-included files matching 'lextab.*' found under directory 'examples'
Build the lexing/parsing tables
Successfully installed pycparser
Cleaning up...

root@vagrant-ubuntu-trusty-64:/vagrant/NetOpsWorkshop/install# pip list
apt-xapian-index (0.45)
argparse (1.2.1)
bracket-expansion (0.1.0)
cffi (1.11.0)
now i can install ansible
root@vagrant-ubuntu-trusty-64:/vagrant/NetOpsWorkshop/install# sudo pip install -q pynacl
root@vagrant-ubuntu-trusty-64:/vagrant/NetOpsWorkshop/install# sudo pip install -q yamllint textfsm jmespath
root@vagrant-ubuntu-trusty-64:/vagrant/NetOpsWorkshop/install# sudo pip install -q ansible
root@vagrant-ubuntu-trusty-64:/vagrant/NetOpsWorkshop/install# sudo pip install -q napalm-eos napalm-ios napalm-junos napalm-nxos napalm-iosxr
root@vagrant-ubuntu-trusty-64:/vagrant/NetOpsWorkshop/install# sudo pip install -q --no-deps napalm
root@vagrant-ubuntu-trusty-64:/vagrant/NetOpsWorkshop/install# ansible-playbook --version
ansible-playbook 2.4.0.0
config file = None
configured module search path = [u'/root/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/local/lib/python2.7/dist-packages/ansible
executable location = /usr/local/bin/ansible-playbook
python version = 2.7.6 (default, Oct 26 2016, 20:30:19) [GCC 4.8.4]


Reply