Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

So I built this rails application locally and deployed it via Heroku. There is this important python script I rely on that heavily uses the pycurl library. My script is able to run locally because I was able to easily download and install pycurl on my local machine. The problem is pycurl is not installed remotely on Heroku, and I cannot seem to figure out how to install pycurl so that Heroku can run my python script. I downloaded setuptools, as well as the pycurl tar file in my rails app and tried to ssh into heroku and run something like python setyp.py install, or pip install pycurl, however, none of these commands will run because I do not and cannot have write access to this directory: /usr/local/lib/python2.7/site-packages/ on heroku (you also cannot run these commands as root because Heroku will not allow you too). After trying everything, it seems like I should follow these instructions from Heroku, which gets printed to my terminal after running python setup.py install:

".....If you do not have administrative access to this machine, you may wish to choose a different installation directory, preferably one that is listed in your PYTHONPATH environment variable."

I am not sure how to go about this. Any help wold be much appreciated.

Also, I have come across a few stack overflow posts but none have been able to help so far. Let me know if you need any more info from me.

TL;DR - Installing a python module/library on Heroku.

share|improve this question

1 Answer

add a requirements.txt file to your python deployment. Write your python dependencies in it (add any other dependencies you have not only pycurl). check this doc from heroku guys

I use pycurl on my heroku app and have found no problem uploading to heroku..

  Installing dependencies using Pip (1.3.1)
   Downloading/unpacking pycurl==7.19.0 (from -r requirements.txt (line 11))
     Running setup.py egg_info for package pycurl
       Using curl-config (libcurl 7.19.7)  

  Installing collected packages: pycurl
     Running setup.py install for pycurl
       Using curl-config (libcurl 7.19.7)
       building 'pycurl' extension
       gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/app/.heroku/python/include/python2.7 -c src/pycurl.c -o build/temp.linux-x86_64-2.7/src/pycurl.o
       src/pycurl.c: In function ‘do_multi_info_read’:
       src/pycurl.c:2843: warning: call to ‘_curl_easy_getinfo_err_string’ declared with attribute warning: curl_easy_getinfo expects a pointer to char * for this info
       src/pycurl.c: In function ‘multi_socket_callback’:
       src/pycurl.c:2355: warning: call to ‘_curl_easy_getinfo_err_string’ declared with attribute warning: curl_easy_getinfo expects a pointer to char * for this info
       In function ‘util_curl_unsetopt’,
           inlined from ‘do_curl_unsetopt’ at src/pycurl.c:1551:
       src/pycurl.c:1476: warning: call to ‘_curl_easy_setopt_err_CURLSH’ declared with attribute warning: curl_easy_setopt expects a CURLSH* argument for this option
       gcc -pthread -shared build/temp.linux-x86_64-2.7/src/pycurl.o -lcurl -lidn -lssl -lcrypto -llber -lldap -lrt -lgssapi_krb5 -lgssapi_krb5 -lssl -lcrypto -lz -o build/lib.linux-x86_64-2.7/pycurl.so /usr/lib/libcurl.a

 Successfully installed pycurl
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.