无法在Heroku上安装pycurl

时间:2014-10-16 13:13:41

标签: python django heroku deployment pycurl

我正在尝试在Heroku上部署Django应用程序。我在requirements.txt上有pycurl == 7.19.5,当我尝试git push heroku master时,我收到错误“推送被拒绝,无法编译Python应用程序”。当我从requirements.txt中删除pycurl时,一切都顺利进行。我可以稍后安装pycurl,但是当我尝试打开我的应用程序时,我收到一个错误“ImportError:没有名为pycurl的模块”即使我可以安装pycurl,它似乎没有正确安装。我的目标是在Heroku上安装pycurl,我是怎么做到的?

尝试“git push heroku master”时出现错误消息,而pycurl位于requirements.txt中:

-----> Installing dependencies with pip
   Downloading/unpacking pycurl (from -r requirements.txt (line 20))
     Running setup.py (path:/tmp/pip_build_u41771/pycurl/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 -DPYCURL_VERSION="7.19.5" -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/app/.heroku/python/include/python2.7 -c src/docstrings.c -o build/temp.linux-x86_64-2.7/src/docstrings.o
       gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPYCURL_VERSION="7.19.5" -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/app/.heroku/python/include/python2.7 -c src/easy.c -o build/temp.linux-x86_64-2.7/src/easy.o
       src/easy.c: In function ‘do_curl_getinfo’:
       src/easy.c:1985: warning: call to ‘_curl_easy_getinfo_err_curl_slist’ declared with attribute warning: curl_easy_getinfo expects a pointer to struct curl_slist * for this info
       gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPYCURL_VERSION="7.19.5" -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/app/.heroku/python/include/python2.7 -c src/module.c -o build/temp.linux-x86_64-2.7/src/module.o
       src/module.c: In function ‘initpycurl’:
       src/module.c:723: error: ‘CURLPROTO_IMAP’ undeclared (first use in this function)
       src/module.c:723: error: (Each undeclared identifier is reported only once
       src/module.c:723: error: for each function it appears in.)
       src/module.c:724: error: ‘CURLPROTO_IMAPS’ undeclared (first use in this function)
       src/module.c:725: error: ‘CURLPROTO_POP3’ undeclared (first use in this function)
       src/module.c:726: error: ‘CURLPROTO_POP3S’ undeclared (first use in this function)
       src/module.c:727: error: ‘CURLPROTO_SMTP’ undeclared (first use in this function)
       src/module.c:728: error: ‘CURLPROTO_SMTPS’ undeclared (first use in this function)
       src/module.c:729: error: ‘CURLPROTO_RTSP’ undeclared (first use in this function)
       src/module.c:730: error: ‘CURLPROTO_RTMP’ undeclared (first use in this function)
       src/module.c:731: error: ‘CURLPROTO_RTMPT’ undeclared (first use in this function)
       src/module.c:732: error: ‘CURLPROTO_RTMPE’ undeclared (first use in this function)
       src/module.c:733: error: ‘CURLPROTO_RTMPTE’ undeclared (first use in this function)
       src/module.c:734: error: ‘CURLPROTO_RTMPS’ undeclared (first use in this function)
       src/module.c:735: error: ‘CURLPROTO_RTMPTS’ undeclared (first use in this function)
       src/module.c:736: error: ‘CURLPROTO_GOPHER’ undeclared (first use in this function)
       error: command 'gcc' failed with exit status 1
       Complete output from command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_u41771/pycurl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-tasHqS-record/install-record.txt --single-version-externally-managed --compile:
       Using curl-config (libcurl 7.19.7)

   running install

   running build

   running build_py

   creating build

   creating build/lib.linux-x86_64-2.7

   creating build/lib.linux-x86_64-2.7/curl

   copying python/curl/__init__.py -> build/lib.linux-x86_64-2.7/curl

   running build_ext

   building 'pycurl' extension

   creating build/temp.linux-x86_64-2.7

   creating build/temp.linux-x86_64-2.7/src

   gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPYCURL_VERSION="7.19.5" -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/app/.heroku/python/include/python2.7 -c src/docstrings.c -o build/temp.linux-x86_64-2.7/src/docstrings.o

   gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPYCURL_VERSION="7.19.5" -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/app/.heroku/python/include/python2.7 -c src/easy.c -o build/temp.linux-x86_64-2.7/src/easy.o

   src/easy.c: In function ‘do_curl_getinfo’:

   src/easy.c:1985: warning: call to ‘_curl_easy_getinfo_err_curl_slist’ declared with attribute warning: curl_easy_getinfo expects a pointer to struct curl_slist * for this info

   gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DPYCURL_VERSION="7.19.5" -DHAVE_CURL_OPENSSL=1 -DHAVE_CURL_SSL=1 -I/app/.heroku/python/include/python2.7 -c src/module.c -o build/temp.linux-x86_64-2.7/src/module.o

   src/module.c: In function ‘initpycurl’:

   src/module.c:723: error: ‘CURLPROTO_IMAP’ undeclared (first use in this function)

   src/module.c:723: error: (Each undeclared identifier is reported only once

   src/module.c:723: error: for each function it appears in.)

   src/module.c:724: error: ‘CURLPROTO_IMAPS’ undeclared (first use in this function)

   src/module.c:725: error: ‘CURLPROTO_POP3’ undeclared (first use in this function)

   src/module.c:726: error: ‘CURLPROTO_POP3S’ undeclared (first use in this function)

   src/module.c:727: error: ‘CURLPROTO_SMTP’ undeclared (first use in this function)

   src/module.c:728: error: ‘CURLPROTO_SMTPS’ undeclared (first use in this function)

   src/module.c:729: error: ‘CURLPROTO_RTSP’ undeclared (first use in this function)

   src/module.c:730: error: ‘CURLPROTO_RTMP’ undeclared (first use in this function)

   src/module.c:731: error: ‘CURLPROTO_RTMPT’ undeclared (first use in this function)

   src/module.c:732: error: ‘CURLPROTO_RTMPE’ undeclared (first use in this function)

   src/module.c:733: error: ‘CURLPROTO_RTMPTE’ undeclared (first use in this function)

   src/module.c:734: error: ‘CURLPROTO_RTMPS’ undeclared (first use in this function)

   src/module.c:735: error: ‘CURLPROTO_RTMPTS’ undeclared (first use in this function)

   src/module.c:736: error: ‘CURLPROTO_GOPHER’ undeclared (first use in this function)

   error: command 'gcc' failed with exit status 1

   ----------------------------------------
   Cleaning up...
   Command /app/.heroku/python/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_u41771/pycurl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-tasHqS-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_u41771/pycurl
Traceback (most recent call last):
  File "/app/.heroku/python/bin/pip", line 9, in <module>
    load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
  File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/__init__.py", line 185, in main
    return command.main(cmd_args)
  File "/app/.heroku/python/lib/python2.7/site-packages/pip-1.5.6-py2.7.egg/pip/basecommand.py", line 161, in main
    text = '\n'.join(complete_log)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 28: ordinal not in range(128)

 !     Push rejected, failed to compile Python app

To git@heroku.com:floating-sands-9523.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:floating-sands-9523.git'

在Heroku上部署django应用程序时在日志中出现错误消息,而不是在requirements.txt中使用pycurl(但稍后使用pip安装它)并运行带有“heroku open”的应用程序:

    2014-10-16T12:23:23.107977+00:00 app[web.1]: [2014-10-16 12:23:23 +0000] [7] [ERROR] Error handling request
2014-10-16T12:23:23.107998+00:00 app[web.1]: Traceback (most recent call last):
2014-10-16T12:23:23.108000+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 93, in handle
2014-10-16T12:23:23.108001+00:00 app[web.1]:     self.handle_request(listener, req, client, addr)
2014-10-16T12:23:23.108003+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/gunicorn/workers/sync.py", line 134, in handle_request
2014-10-16T12:23:23.108004+00:00 app[web.1]:     respiter = self.wsgi(environ, resp.start_response)
2014-10-16T12:23:23.108005+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 206, in __call__
2014-10-16T12:23:23.108006+00:00 app[web.1]:     response = self.get_response(request)
2014-10-16T12:23:23.108008+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 185, in get_response
2014-10-16T12:23:23.108009+00:00 app[web.1]:     resolver, sys.exc_info())
2014-10-16T12:23:23.108010+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/handlers/base.py", line 232, in handle_uncaught_exception
2014-10-16T12:23:23.108012+00:00 app[web.1]:     if resolver.urlconf_module is None:
2014-10-16T12:23:23.108013+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/core/urlresolvers.py", line 360, in urlconf_module
2014-10-16T12:23:23.108014+00:00 app[web.1]:     self._urlconf_module = import_module(self.urlconf_name)
2014-10-16T12:23:23.108016+00:00 app[web.1]:   File "/app/.heroku/python/lib/python2.7/site-packages/django/utils/importlib.py", line 40, in import_module
2014-10-16T12:23:23.108017+00:00 app[web.1]:     __import__(name)
2014-10-16T12:23:23.108018+00:00 app[web.1]:   File "/app/myApp/urls.py", line 4, in <module>
2014-10-16T12:23:23.108019+00:00 app[web.1]:     from myApp.API.RegistrationAPI import RegistrationAPI
2014-10-16T12:23:23.108020+00:00 app[web.1]:   File "/app/myApp/API/RegistrationAPI.py", line 4, in <module>
2014-10-16T12:23:23.108022+00:00 app[web.1]:     import pycurl
2014-10-16T12:23:23.108023+00:00 app[web.1]: ImportError: No module named pycurl

我是第一次部署,我已按照Heroku网站上的说明进行了操作(https://devcenter.heroku.com/articles/getting-started-with-django#django-settings

谢谢你帮助我!如果您需要更多信息,请与我们联系。

0 个答案:

没有答案