Anyone know how to install PyICU on Heroku?
Here is what I tried so far:
- Created a heroku-buildpack-multi application.
In .buildpacks
https://github.com/ddollar/heroku-buildpack-apt
https://github.com/heroku/heroku-buildpack-python.git
In Aptfile
libicu52
libicu-dev
Then heroku run bash
CPATH=$CPATH/app/.apt/usr/include/x86_64-linux-gnu
pip install PyICU
And it installs fine.
I need one way to do that during the application's upload phase (push).
I tried:
pip install --global-option=build_ext --global-option="-I/app/.apt/usr/lib/x86_64-linux-gnu" PyICU
and to create a .pydistutils.cfg file in my home directory as
[build_ext]
include_dirs=/app/.apt/usr/include/x86_64-linux-gnu
In both cases GCC fails to find the header files, but I can see the
-I/app/.apt/usr/lib/x86_64-linux-gnu
flag on the command line.
Used
`gcc -print-prog-name=cc1plus` -v
to find the differences in search paths before and after CPATH=$CPATH/app/.apt/usr/include/x86_64-linux-gnu
Before:
#include <...> search starts here:
/app/.apt/usr/include
.
/usr/include/c++/4.8
/usr/include/x86_64-linux-gnu/c++/4.8
/usr/include/c++/4.8/backward
/usr/lib/gcc/x86_64-linux-gnu/4.8/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
/usr/include
End of search list.
After:
#include <...> search starts here:
/app/.apt/usr/include
/app/.apt/usr/include/x86_64-linux-gnu
/usr/include/c++/4.8
/usr/include/x86_64-linux-gnu/c++/4.8
/usr/include/c++/4.8/backward
/usr/lib/gcc/x86_64-linux-gnu/4.8/include
/usr/local/include
/usr/lib/gcc/x86_64-linux-gnu/4.8/include-fixed
/usr/include
End of search list.
But I'm not a C++ programmer and cannot find what is wrong. Any ideas?
This is a working workaround until a proper answer to the question.
Create the application as shown above (use the heroku-buildpack-apt to install libicu52 and libicu-dev).
Upload and enter heroku run bash
CPATH=$CPATH/app/.apt/usr/include/x86_64-linux-gnu
pip install wheel
pip wheel PyICU
This will create a wheel (.whl file) in /app/wheelhouse.
Download the file, save it somewhere in your project and install it by putting its name in your requirements.txt