简体   繁体   English

python-ldap无法在Heroku中安装

[英]python-ldap failed to install in Heroku

It seems like Heroku does not support python-ldap. 看来Heroku不支持python-ldap。 The pip install with "python-ldap==2.3.13" in the requirements.txt file failed with following error in Heroku: 在requirements.txt文件中使用“ python-ldap == 2.3.13”进行的pip安装失败,并在Heroku中出现以下错误:

gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION=2.3.13 -IModules -I/usr/local/openldap-2.3/include -I/usr/include/sasl -I/usr/local/include/python2.7 -c Modules/LDAPObject.c -o build/temp.linux-x86_64-2.7/Modules/LDAPObject.o gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -DHAVE_LIBLDAP_R -DHAVE_SASL -DHAVE_TLS -DLDAPMODULE_VERSION = 2.3.13 -IModules -I / usr / local / openldap-2.3 / include -I / usr / include / sasl -I / usr / local / include / python2.7 -c模块/LDAPObject.c -o build / temp.linux-x86_64-2.7 / Modules / LDAPObject.o

Modules/LDAPObject.c:18:18: error: sasl.h: No such file or directory Modules / LDAPObject.c:18:18:错误:sasl.h:没有这样的文件或目录

It seems like Heroku does not have the libraries required for python-ldap and I don't know if there is a way to install dependency libraries except 'pip'. 似乎Heroku没有python-ldap所需的库,而且我不知道是否有一种方法可以安装除'pip'以外的依赖库。

What is the recommended solution to support ldap authentications in Heroku's Python/Django stack? 在Heroku的Python / Django堆栈中支持ldap身份验证的推荐解决方案是什么?

Your help is greatly appreciated. 非常感谢您的帮助。

You can create a custom build pack that vendors in any libraries you like. 您可以在您喜欢的任何库中创建供供应商使用的自定义构建包。 Take a look at https://github.com/cirlabs/heroku-buildpack-geodjango it installs a library via Curl. 看看https://github.com/cirlabs/heroku-buildpack-geodjango,它通过Curl安装了一个库。

I know this question is old, but I had the same problem and Google brought me here. 我知道这个问题很旧,但是我遇到了同样的问题,谷歌把我带到了这里。 I'll write what I found so maybe I can help people that have the same problem and want a currently working solution. 我将写出我发现的内容,以便也许可以帮助遇到相同问题并需要当前有效解决方案的人们。

As @Schneems said you can create your own buildpack using heroku and add your custom environment. 正如@Schneems所说,您可以使用heroku创建自己的buildpack并添加自定义环境。

You can create a custom buildpack containing python-ldap, but, creating a custom buildpack from zero is not really an option for some, so you can fork the official python buildpack https://github.com/heroku/heroku-buildpack-python and add it python-ldap as @damgad did. 您可以创建一个包含python-ldap的自定义buildpack,但是从零开始创建一个自定义buildpack并不是某些人的选择,因此您可以派生官方python buildpack https://github.com/heroku/heroku-buildpack-python并像@damgad一样将其添加到python-ldap中。

The problem here is that the repo from @damgad is outdated compared to the recent version of the official python/buildpack. 这里的问题是,与最新版本的官方python / buildpack相比,@ damgad的存储库已过时。 (At the time of this comment) (在此评论时)

I found this pull request(now closed) https://github.com/heroku/heroku-buildpack-python/pull/271 from a guy that used @damgad code and created his own fork https://github.com/josegonzalez/heroku-buildpack-python . 我发现这拉请求(现已关闭) https://github.com/heroku/heroku-buildpack-python/pull/271从一个家伙,使用@damgad代码,并创建了自己的叉子https://github.com/josegonzalez / heroku-buildpack-python

I tried using it, but his repo was outdated and got some errors deploying my app. 我尝试使用它,但是他的仓库已经过时,并且在部署我的应用程序时出现了一些错误。

So I just created my own fork of the currently official heroku/python buildpack added it https://github.com/josegonzalez/heroku-buildpack-python . 所以我刚刚创建了我自己的当前官方的heroku / python buildpack的fork,并添加了它https://github.com/josegonzalez/heroku-buildpack-python code, fixed just some errors I was getting and you have this currently working buildpack with python-ldap https://github.com/manuggz/heroku-buildpack-python . 代码,仅修复了我遇到的一些错误,并且您当前正在使用python-ldap https://github.com/manuggz/heroku-buildpack-python进行构建。

This buildpack supports python3.6 and thats all I wanted. 这个buildpack支持python3.6,这就是我想要的。

Tl;dr You have to use this updated buildpack if you want to use python-ldap (or create your own forking the official buildpack ): Tl; dr如果要使用python-ldap(或创建自己的官方buildpack分支),则必须使用此更新的 buildpack:

$ heroku buildpacks:set https://github.com/manuggz/heroku-buildpack-python 

I recelntly created heroku buildpack that supports python-ldap . 我创建了支持python-ldap heroku buildpack。 It's availabale on my github repo . 它在我的github repo上可用。

To make it work you only need to specify environment variable like that: 要使其工作,您只需要指定如下环境变量:

heroku config:set BUILDPACK_URL=https://github.com/damgad/heroku-buildpack-python-ldap.git

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM