Heroku buildpacks - install executable files used by Python packages

I am trying to install M2Crypto on Heroku. It depends on the installation of SWIG.

I created a custom compiled swig executable and custom buildpack .

Then I git push my code to Heroku, the custom buildpack installs SWIG, then tries to install M2Crypto, but fails because it cannot find swig .

This is the buildpack setup:

 # 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 executed.

If I heroku run bash and then manually run source .heroku/venv/bin/activate && pip install M2Crypto , it will not install any problems and my application runs inside the bash prompt for the lifetime of this instance.

I think there is a problem with setting up PATH when starting the initial pip install -r requirements ... any ideas?

+6
source share
1 answer

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 material is created when buildpack is running - not / app / (where it lives when the application starts!

+4
source

Source: https://habr.com/ru/post/914233/


All Articles