本文介绍了Memcached在Heroku w / Django:无法安装pylibmc / memcacheify的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 我花了很多时间在这上面,这显然超出了我的新手理解/技能。我尝试使用pip install安装 django-heroku-memcacheify ,这会导致错误。我将问题跟踪到 pylibmc ,这是导致所有问题。这是错误日志中有趣的部分之一: _pylibmcmodule.h:42:36:错误:libmemcached / memcached.h:没有这样的文件或目录 这是(几乎)完整的追溯: -----> Heroku接收推送 ----->获取自定义buildpack ...完成 -----> Python应用程序检测到 ----->准备Python解释器(2.7.2) ----->创建Virtualenv版本1.7.2 ! CLEAN_VIRTUALENV设置,重建virtualenv。 使用解释器运行virtualenv /usr/local/bin/python2.7 .heroku / venv / bin / python2.7中的新的python可执行文件不覆盖现有的python脚本.heroku / venv / bin / python(你必须使用.heroku / venv / bin / python2.7)安装发布..................... .................................................. .................................................. .................................................. ......................完成。 安装pip ................完成。 ----->激活virtualenv ----->使用pip版本1.1 安装依赖项要求已经满足(使用 - 升级升级):中的Django == 1.4 ./.heroku/venv/lib/python2.7/site-packages(from - r要求/ common.txt(第2行))要求已经满足(使用 - 升级升级):gunicorn == 0.14.3 in ./.heroku/venv/lib/python2.7/site-packages (从-r要求/ common.txt(第3行))要求已经满足(使用 - 升级升级):PIL == 1.1.7 in ./.heroku/venv/lib/python2.7/ site-packages / PIL(来自-r要求/ common.txt(第4行))需求已经满足(使用 - 升级升级):South == 0.7.5 in ./.heroku/venv/lib /python2.7/site-packages(从-r要求/ common.txt(第5行))要求已经满足(使用 - 升级升级):boto == 2.1.1 in 。 /.heroku/venv/lib/python2.7/site-packages(来自-r要求/ common.txt(第6行))下载/解包分发== 0.6.10(从-r请求ements / common.txt(第7行))使用/app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fd%中的下载缓存2Fdistribute%2Fdistribute-0.6.10.tar.gz 运行setup.py egg_info for package distribute 要求已经满足(使用 - 升级升级):python-dateutil == 1.5 ./.heroku/venv/lib/python2.7/site-packages(从-r要求/ common.txt(第8行))需求已经满足(使用 - 升级升级):6 == 1.1 .0./.heroku/venv/lib/python2.7/site-packages(来自-r要求/ common.txt(第9行))要求已经满足(使用 - 升级升级):django -appconf == 0.5 in ./.heroku/venv/lib/python2.7/site-packages(来自-r requirements / common.txt(第10行))要求已经满足(使用 - 升级升级):dj-database-url == 0.2.0 in ./.heroku/venv/lib/python2.7/site-packages(from -r requirements / common.txt(line 11)) Downlo使用/app/tmp/repo.git/.cache/pip_downloads/http%3A%2F中的下载缓存来使用django-compressor == dev(来自-r requirements / common.txt(第12行)) %2Fgithub.com%2Fjezdez%2Fdjango_compressor%2Ftarball%2Fdevelop 无法确定文件/app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fgithub.com%2Fjezdez%2Fdjango_compressor%的压缩类型2Ftarball%2Fdevelop 运行setup.py egg_info for django-compression 请求的django-compress == dev(来自-r requirements / common.txt(第12行)),但安装版本1.2a2 要求已经满足(使用 - 升级升级):django-crispy-forms == 1.1.2 in ./.heroku/venv/lib/python2.7/site-packages(from -r requirements /common.txt(第13行))需求已经满足(使用 - 升级升级):django-extensions == 0.9 in ./.heroku/venv/lib/python2.7/site-packages(from -r要求/ common.txt(第14行))要求alrea dy满意(使用 - 升级升级):django-facebook == 4.0.9 in ./.heroku/venv/lib/python2.7/site-packages(from -r requirements / common.txt(第15行)) 要求已经满足(使用 - 升级升级):django-floppyforms == 1.0 in ./.heroku/venv/lib/python2.7/site-packages(from -r requirements / common.txt(line 16))需求已经满足(使用 - 升级升级):django-guardian == 1.0.4 in ./.heroku/venv/lib/python2.7/site-packages(from -r requirements / common.txt(第17行))需求已经满足(使用 - 升级升级):django-image-cropping == 0.5 in ./.heroku/venv/lib/python2.7/site-packages(从-r要求/ common.txt(第18行))要求已经满足(使用 - 升级升级):django-rating == 0.3.6 in ./.heroku/venv/lib/python2.7 / site-packages(来自-r requirements / common.txt(第19行))需求已经满足(使用 - 升级升级):django-smuggler == 0.3 in ./.heroku/venv/l ib / python2.7 / site-packages(来自-r要求/ common.txt(第20行))要求已经满足(使用 - 升级升级):django-storages == 1.1.4 in ./需求已经满足(使用 - 升级升级):django-subdomains == 1.2 .1 in ./.heroku/venv/lib/python2.7/site-packages(从-r要求/ common.txt(第22行))要求已经满足(使用 - 升级升级):django -s3-folder-storage == 0.1 in ./.heroku/venv/lib/python2.7/site-packages(来自-r requirements / common.txt(第23行))要求已经满足(use - 升级升级):django-userena == 1.1.0 in ./.heroku/venv/lib/python2.7/site-packages(from -r requirements / common.txt(line 24))要求已经满足(使用 - 升级升级):Whoosh == 2.4.0 in ./.heroku/venv/lib/python2.7/site-packages(from -r requirements / common.txt(第25行))要求uirement已经满足(使用 - 升级升级):brabeion == 0.1 in ./.heroku/venv/lib/python2.7/site-packages(from -r requirements / common.txt(第26行))需求已经满足(使用 - 升级升级):versiontools == 1.9.1 in ./.heroku/venv/lib/python2.7/site-packages(来自-r requirements / common.txt(第27行)) 从git + https获取django-haystack://github.com/toastdriven/django-haystack.git@25bd361d3c64cc22a1090a5053465939647d973d#egg=django_haystack-dev(来自-r requirements / common.txt(第28行))更新./.heroku/src/django-haystack克隆(到25bd361d3c64cc22a1090a5053465939647d973d)假设提交,找不到标签或分支25bd361d3c64cc22a1090a5053465939647d973d。 运行setup.py egg_info for django-haystack 从git + git获取django-taggit://github.com/shacker/django-taggit.git@7987beaf357f8d3621c7fbce3b6753dd21962ee7#egg=django_taggit -dev(来自-r requirements / common.txt(第29行))更新./.heroku/src/django-taggit克隆(到7987beaf357f8d3621c7fbce3b6753dd21962ee7)找不到标签或分支'7987beaf357f8d3621c7fbce3b6753dd21962ee7'假设承诺。 运行setup.py egg_info for package django-taggit 从git + git获取django-generic-aggregation://github.com/coleifer/django-generic-aggregation.git@c76408c2c002dcab6bfc3148760ee58a19cbe05e #egg = django_generic_aggregation-dev(来自-r requirements / common.txt(第30行))更新./.heroku/src/django-generic-aggregation克隆(c76408c2c002dcab6bfc3148760ee58a19cbe05e)找不到标签或分支'c76408c2c002dcab6bfc3148760ee58a19cbe05e',假设提交。 运行setup.py egg_info for django-generic-aggregation 需求已经满足(使用 - 升级升级):easy-thumbnailails == 1.0.3 in ./.heroku/需要已经满足(使用 - 升级升级):docutils == 0.9 in ./.heroku(从-r要求/ common.txt(第31行)) /venv/lib/python2.7/site-packages(来自-r要求/ common.txt(第32行))要求已经满足(使用 - 升级升级):httplib2 == 0.7.4 in。 /.heroku/venv/lib/python2.7/site-packages(来自-r要求/ common.txt (第33行))要求已经满足(使用 - 升级升级):reportlab == 2.5 in ./.heroku/venv/lib/python2.7/site-packages(来自-r requirements / common.txt(第34行))要求已经满足(使用 - 升级升级):wsgiref == 0.1.2 在/usr/local/lib/python2.7(从-r要求/ common.txt(第35行))下载/解包d jango-pylibmc-sasl == 0.2.4(从-r要求/ prod.txt(第3行))下载django-pylibmc-sasl-0.2.4.tar.gz 将缓存存储在缓存中在/app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fd%2Fdjango-pylibmc-sasl%2Fdjango-pylibmc-sasl-0.2.4.tar .gz 运行setup.py egg_info for package django-pylibmc-sasl 需求已经满足(使用 - 升级升级):psycopg2 == 2.4.5 in ./.heroku/ venv / lib / python2.7 / site-packages(从-r要求/ prod.txt(第4行))下载/解压pylibmc == 1.2.3(从-r requirements / prod.txt(第5行) ))将缓存中的下载存储在/app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fpypi.python.org%2Fpackages%2Fsource%2Fp%2Fpylibmc%2Fpylibmc-1.2.3 .tar.gz 运行setup.py egg_info包pylibmc 下载/解包django-heroku-memcacheify == 0.3(从-r requirements / prod.txt(第6行) ))下载django-heroku-memcacheify-0.3.tar.gz 将缓存中的下载存储在/app/tmp/repo.git/.cache/pip_downloads/http%3A%2F%2Fpypi.python .org%2Fpackages%2Fsource%2Fd%2Fdjango-heroku-memcacheify%2Fdjango-heroku-memcacheify-0.3.tar.gz 运行setup.py egg_info for django-heroku-memcacheify 安装收集的软件包:distributed,django-compression,django-haystack,django-taggit,django-generic-aggregation,django-pylibmc-sasl,pylibmc,django-heroku-memcacheify 发现现有安装:distribution 0.6.27 卸载分发:成功卸载分发运行setup.py安装以分发在安装bootstrap之前。 扫描已安装的软件包在/tmp/build_vk3edwx3xe4q/.heroku/venv/lib/python2.7/site-packages 中检测到安装工具安装非蛋安装将元素从方式... 已经打补丁了。已经打补丁的 /tmp/build_vk3edwx3xe4q/.heroku/venv/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info。 安装easy_install脚本到/tmp/build_vk3edwx3xe4q/.heroku/venv/bin 安装easy_install-2.7脚本到/tmp/build_vk3edwx3xe4q/.heroku/venv/bin 安装后引导。 /tmp/build_vk3edwx3xe4q/.heroku/venv/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg-info已存在发现现有的安装:django-compression 1.2 a2 卸载django-compression:成功卸载django-compression 运行django-compression $ setup $ install $ b运行setup.py开发for django-haystack 创建/tmp/build_vk3edwx3xe4q/.heroku/venv/lib/python2.7/site-packages/django-haystack.egg-link(链接到) django-haystack 2.0.0 -beta已经是easy-install.pth中的活动版本 安装的/tmp/build_vk3edwx3xe4q/.heroku/src/django-haystack 运行setup.py开发for django-taggit 创建/tmp/build_vk3edwx3xe4q/.heroku/venv/lib/python2.7/site-packages/django-taggit.egg-link(链接到) django-taggit 0.9.4是已经在easy-install.pth中的活动版本 已安装/ tmp / build_vk3edwx3xe4q / .heroku / src / django-taggit 运行setup.py开发for django-generic-aggregation 创建/tmp/build_vk3edwx3xe4q/.heroku/venv/lib/python2.7/ site-packages / django-generic-aggregation.egg-link(链接到) django-generic-aggregation 0.3.1已经是easy-install.pth中的活动版本 已安装/tmp/build_vk3edwx3xe4q/.heroku/src/django-generic-aggregation 为django-pylibmc-sasl运行setup.py install 为pylibmc运行setup.py install building '_pylibmc'extension gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I / usr / local / include / python2。 7 -c _pylibmcmodule.c -o build / temp.linux-x86_64-2.7 / _pylibmcmodule.o -fno-strict-aliasing 在_pylibmcmodule.c中包含的文件中:34: _pylibmcmodule.h:42 :36:错误:libmemcached / memcached.h:没有这样的文件或目录 _pylibmcmodule.c:在函数â〜〜init_pylibmcâ?T: _pylibmcmodule.c:2140:错误:â〜〜LIBMEMCACHED_VERSION_STRING?未声明(首先在此函数中使用) _pylibmcmodule.c:2140:warning :从不兼容的指针类型 /usr/local/include/python2.7/modsupport.h:42传递â〜〜PyModule_AddStringConstantâT的参数3:注意:预期â〜〜const char *â?T但是参数是类型â?〜struct PylibMC_Behavior *â?T 错误:命令'gcc'失败,退出状态1 从命令/tmp/build_vk3edwx3xe4q/.heroku/venv/bin/python2.7完成输出-cimport setuptools; __ file __ ='/ tmp / build_vk3edwx3xe4q / .heroku / venv / build / pylibmc / setup.py'; exec(compile(open(__ file __))read()。replace('\r\\\ ','\\\'),__file__,'exec'))install --single-version-external-managed --record /tmp/pip-Y7MRuY-record/install-record.txt --install-headers / tmp / build_vk3edwx3xe4q / .heroku / venv / include / site / python2.7:运行安装 运行build 运行build_py 创建构建 创建构建/ lib.linux-x86_64-2.7 创建build / lib.linux-x86_64-2.7 / pylibmc 复制pylibmc / __ main__.py - > build / lib.linux-x86_64-2.7 / pylibmc 复制pylibmc / pools.py - > build / lib.linux-x86_64-2.7 / pylibmc 复制pylibmc / __ init__.py - > build / lib.linux-x86_64-2.7 / pylibmc 复制pylibmc / client.py - > build / lib.linux-x86_64-2.7 / pylibmc 复制pylibmc / consts.py - > build / lib.linux-x86_64-2.7 / pylibmc 复制pylibmc / test.py - > build / lib.linux-x86_64-2.7 / pylibmc 运行build_ext 构建'_pylibmc'扩展 创建build / temp.linux-x86_64 -2.7 gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I / usr / local / include / python2.7 -c _pylibmcmodule.c -o build / temp.linux-x86_64-2.7 / _pylibmcmodule.o -fno-strict-aliasing 在_pylibmcmodule.c中包含的文件中:34: _pylibmcmodule.h:42:36:错误:libmemcached / memcached.h:没有这样的文件或目录 在_pylibmcmodule.c中包含的文件中:34: _pylibmcmodule.h:75:错误:预期声明说明符或â?〜...â?T之前â?〜*â?T令牌 ...很多错误... _pylibmcmodule.c:在函数â〜〜init_pylibmcâ?T: _pylibmcmodule.c:2140:错误:â〜〜LIBMEMCACHED_VERSION_STRING?未声明(首先使用在这个功能) _pylibmcmodule.c:2140:warning:从不兼容的指针类型 /usr/local/include/python2.7/modsupport.h:42传递参数3的PyModule_AddStringConstant?T:注意:预期â?〜const char *â? T但是参数是类型â?〜struct PylibMC_Behavior *â?T error:command'gcc'failed with exit status 1 -------- -------------------------------- 命令/tmp/build_vk3edwx3xe4q/.heroku/venv/bin/python2 .7 -cimport setuptools; __ file __ ='/ tmp / build_vk3edwx3xe4q / .heroku / venv / build / pylibmc / setup.py'; exec(compile(open(__ file __))read()replace('\r\\ \\ n','\\\'),__file__,'exec'))install --single-version-external-managed --record /tmp/pip-Y7MRuY-record/install-record.txt --install- /tmp/build_vk3edwx3xe4q/.heroku/venv/include/site/python2.7失败,错误代码1在/tmp/build_vk3edwx3xe4q/.heroku/venv/build/pylibmc 存储完整的日志/app/.pip /pip.log ! Heroku推送拒绝,无法编译Python应用程序 To [email protected]:crowdcademy.git ! [远程拒绝]主 - > master(预收款钩子拒绝)错误:未能推一些参考[email protected]:crowdcademy.git 所以这里是交易 我无法在本地的env b / c中测试在一扇窗户上跑步。但是从我读过的 libmemcached 是。没有人似乎与pylibmc有任何问题,因为我找不到任何东西在谷歌。 在这篇文章中,他们在谈论:That might be the problem, either it's not provided or the path is wrong. Any help is appreciated! if this doesn't work out I'll have to use Redis which seems to be a lot harder... don't know if I'm advanced enough for that. EditMight be irrelevant, but I'm using a settings folder with init instead of a settings.py file. I've heard that this can lead to some strange behaviour since heroku doesn't always remember that this is possible.Edit 2Since there are hundreds of people runnning memcached and django on heroku without any problems, I don't think that heroku-users are supposed to install libmemcached with some sort of hack. The docs talk about it as if it is bootstrapped for you when heroku detects pylibmc in your requirements file. Which leads me to the conclusion: A) either there is something wrong in my settings or in one of the apps I use or B) heroku changed something recently and broke the automatic bootstrapping of libmemcached for django. I've tried to get a fresh install with heroku config:add CLEAN_VIRTUALENV=true but that's not working either right now. I'm hoping that it's A and somebody has had the same problem. If it's B I have no idea how to solve it. 解决方案 I've talked to the friendly folks at Heroku and it seems like my requirements.txt setup was causing all the havoc. Don't use a requirements file in root that imports from another requirements file! At least for pylibmc that's not working because libmemcached doesn't get bootstrapped if there is no explicit line with pylibmc in the root requirements file. I hope this will help others avoid wasting the 10 hrs I've spent on this problem. Yay! 这篇关于Memcached在Heroku w / Django:无法安装pylibmc / memcacheify的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!
10-10 04:02