Failed to install dependency on Bluemix with a personal setup pypiserver
<p>I'm trying to push a python Django application in Bluemix.</p>

<p>I use some global dependency, and a personal package which have some global dependency. </p>

<p>My application runs good, when I just add my personal package in my application folder. </p>

<p>e.g.in requirements.txt:</p>

<pre><code>Mezzanine==4.1.0
cartridge
Django==1.9.7
-r ./my_personal_package/requirements.txt
</code></pre>

<p>in ./my_personal_package/requirements.txt: </p>

<pre><code>pyOpenSSL==16.0.0
requests==2.9.1
psutil==4.3.0
</code></pre>

<p>But, if I package my personal package as a pypi package with pip tool. and put it in a personal pypi server that bluemix can access. My application will be failed to start. it failed on install a cffi package(Error message append in the end of this question)</p>

<p>my requirements.txt is as following:</p>

<pre><code>-extra-index-url https://mypypiserver.mybluemix.net/repos/simple/
my-personal-package
Mezzanine==4.1.0
cartridge
Django==1.9.7
</code></pre>

<p>I compared the packages downloaded with method 1 and method 2, they are exactly the same. method 2 only failed on installing cffi:</p>

<pre><code>2016-09-08T20:40:32.62-0500 [STG/0]      OUT          Running setup.py install for cffi: started
2016-09-08T20:40:33.42-0500 [STG/0]      OUT            Running setup.py install for cffi: finished with status 'error'
</code></pre>

<p>Error Messages:</p>

<pre><code>016-09-08T20:40:33.43-0500 [STG/0]      OUT            Complete output from command /app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-k3BUbl/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-C_rmOt-record/install-record.txt --single-version-externally-managed --compile:
2016-09-08T20:40:33.43-0500 [STG/0]      OUT            Perhaps you should add the directory containing `libffi.pc'
2016-09-08T20:40:33.43-0500 [STG/0]      OUT            to the PKG_CONFIG_PATH environment variable
2016-09-08T20:40:33.43-0500 [STG/0]      OUT            Package libffi was not found in the pkg-config search path.
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            Package libffi was not found in the pkg-config search path.
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            Perhaps you should add the directory containing `libffi.pc'
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            to the PKG_CONFIG_PATH environment variable
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            Package libffi was not found in the pkg-config search path.
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            to the PKG_CONFIG_PATH environment variable
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            Package libffi was not found in the pkg-config search path.
2016-09-08T20:40:33.43-0500 [STG/0]      OUT            Package libffi was not found in the pkg-config search path.
2016-09-08T20:40:33.43-0500 [STG/0]      OUT            Perhaps you should add the directory containing `libffi.pc'
2016-09-08T20:40:33.43-0500 [STG/0]      OUT            to the PKG_CONFIG_PATH environment variable
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            No package 'libffi' found
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            Perhaps you should add the directory containing `libffi.pc'
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            No package 'libffi' found
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            Perhaps you should add the directory containing `libffi.pc'
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            to the PKG_CONFIG_PATH environment variable
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            No package 'libffi' found
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            running install
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            running build
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            running build_py
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            creating build
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            creating build/lib.linux-x86_64-2.7
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            creating build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/cparser.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/vengine_gen.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/commontypes.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/lock.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/recompiler.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/backend_ctypes.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/vengine_cpy.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/__init__.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/setuptools_ext.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/cffi_opcode.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/model.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/ffiplatform.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/api.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/verifier.py -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/_cffi_include.h -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/parse_c_type.h -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            running build_ext
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            building '_cffi_backend' extension
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            creating build/temp.linux-x86_64-2.7/c
2016-09-08T20:40:33.45-0500 [STG/0]      OUT            gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE__THREAD -I/usr/include/ffi -I/usr/include/libffi -I/app/.heroku/python/include/python2.7 -c c/_cffi_backend.c -o build/temp.linux-x86_64-2.7/c/_cffi_backend.o
2016-09-08T20:40:33.45-0500 [STG/0]      OUT            c/_cffi_backend.c:15:17: fatal error: ffi.h: No such file or directory
2016-09-08T20:40:33.45-0500 [STG/0]      OUT             #include &lt;ffi.h&gt;
2016-09-08T20:40:33.45-0500 [STG/0]      OUT            compilation terminated.
2016-09-08T20:40:33.45-0500 [STG/0]      OUT            error: command 'gcc' failed with exit status 1
2016-09-08T20:40:33.45-0500 [STG/0]      OUT            ----------------------------------------
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            copying cffi/_embedding.h -&gt; build/lib.linux-x86_64-2.7/cffi
2016-09-08T20:40:33.44-0500 [STG/0]      OUT            creating build/temp.linux-x86_64-2.7
2016-09-08T20:40:34.65-0500 [STG/0]      ERR Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-k3BUbl/cffi/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-C_rmOt-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-k3BUbl/cffi/
</code></pre>

<p>The cffi installation failed due to "No package 'libffi' found". 'libffi' is notoriously messy to install and use. Since you are using a pypi server hosting dependence packages, the first place that I would like to check is whether the server is setup properly according to <a href="http://cffi.readthedocs.io/en/latest/installation.html" rel="nofollow">cffi installation instructions</a>. </p>

python django ibm-bluemix