Reputation: 5107
I am trying to install M2Crypto on Heroku. This relies on SWIG being installed.
I've created a custom compiled swig
executable and a custom buildpack.
I then git push
my code up to Heroku, the custom buildpack installs SWIG then tries to install M2Crypto but fails because it can't find swig
.
This is the buildpack customisation:
# Install SWIG
if [ ! -d $CACHE_DIR/swig ]; then
cd $BUILD_DIR
echo "-----> Fetching and installing SWIG 2"
curl -O https://s3.amazonaws.com/guybowden/swig.tar.gz >/dev/null 2>&1
echo "-----> Installing ..."
tar xzvf swig.tar.gz >/dev/null 2>&1
mv swig $CACHE_DIR/swig
rm swig.tar.gz
echo "SWIG installed" | indent
fi
mkdir -p .paybox
cp -R $CACHE_DIR/swig .paybox
echo "updating path..." | indent
PATH=$PATH:/app/.paybox/swig/bin/
export PATH
echo $PATH | indent
echo "setting SWIG_LIB environment var"
export SWIG_LIB=/app/.paybox/swig/share/swig/2.0.5/
This happens before any pip install
commands are run.
If I heroku run bash
and then manually run source .heroku/venv/bin/activate && pip install M2Crypto
it installs no problem and my App works inside the bash prompt for the lifetime of that instance.
I think there's a problem with the PATH setting when the initial pip install -r requirements
runs... any ideas?
Upvotes: 8
Views: 1843
Reputation: 5107
And the answer is..
PATH=$PATH:$BUILD_DIR/.paybox/swig/bin/
export PATH
echo $PATH | indent
echo "setting SWIG_LIB environment var"
export SWIG_LIB=$BUILD_DIR/.paybox/swig/share/swig/2.0.5/
$BUILD_DIR is where the stuff is built when the buildpack is executed - not /app/ (which is where it lives when the app runs!
Upvotes: 5