web-dev-qa-db-ja.com

python buildpack-致命的なエラー:sasl / sasl.h:そのようなファイルまたはディレクトリはありません

Bluemixアプリにsaslをインストールすると、次のエラーが表示されます。

       Installing collected packages: sasl, thrift-sasl
         Running setup.py install for sasl: started
           Running setup.py install for sasl: finished with status 'error'
           Command "/app/.heroku/python/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-9mi8225r/sasl/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-3l4o04ga-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-9mi8225r/sasl/
           running install
           running build_py
           creating build
           creating build/lib.linux-x86_64-3.5
           creating build/lib.linux-x86_64-3.5/sasl
           copying sasl/__init__.py -> build/lib.linux-x86_64-3.5/sasl
           running Egg_info
           writing dependency_links to sasl.Egg-info/dependency_links.txt
           writing top-level names to sasl.Egg-info/top_level.txt
           warning: manifest_maker: standard file '-c' not found

           reading manifest file 'sasl.Egg-info/SOURCES.txt'
           writing manifest file 'sasl.Egg-info/SOURCES.txt'
           copying sasl/saslwrapper.cpp -> build/lib.linux-x86_64-3.5/sasl
           copying sasl/saslwrapper.pyx -> build/lib.linux-x86_64-3.5/sasl
           building 'sasl.saslwrapper' extension
           creating build/temp.linux-x86_64-3.5
           creating build/temp.linux-x86_64-3.5/sasl
           gcc -pthread -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -Isasl -I/app/.heroku/python/include/python3.5m -c sasl/saslwrapper.cpp -o build/temp.linux-x86_64-3.5/sasl/saslwrapper.o
           sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
            #include <sasl/sasl.h>
                                  ^
           compilation terminated.

私はビルドパックを使用しています:python 1.5.5

私のruntime.txtには以下が含まれます:python-3.5.0

ビルドパックに必要なヘッダーをインストールするにはどうすればよいですか?


更新:

最新のクラウドファウンドリスタックにsaslライブラリがあるように見えます: https://github.com/cloudfoundry/cflinuxfs2/blob/1.119.0/cflinuxfs2/build/install-packages.sh#L98

Bluemixでこのスタックを使用するにはどうすればよいですか?

9
Chris Snow

私の解決策は、pure-saslを使用して、imquires.txtではなくアプリケーションコードからimyplaとthrift_saslをインストールすることでした。

try:
    import impyla 
except ImportError:
    print("Installing missing impyla")
    import pip
    pip.main(['install', '--no-deps', 'impyla'])

try:
    import thrift_sasl
except ImportError:
    print("Installing missing thrift_sasl")
    import pip
    # need a patched version of thrift_sasl.  see https://github.com/cloudera/impyla/issues/238
    pip.main(['install', '--no-deps',  'git+https://github.com/snowch/thrift_sasl'])

このコードをflaskアプリケーションのビューに追加しました: https://github.com/snowch/movie-recommender-demo/blob/master/web_app/app/main /views.py

1
Chris Snow

インストールする前に、いくつかのシステムライブラリをインストールする必要がありますsaslhttps://pypi.python.org/pypi/sasl/を参照) 0.1.

このライブラリにはC++コードが含まれており、追加のシステムライブラリをインストールする必要があります。

Debian/Ubuntu

apt-get install python-dev libsasl2-dev gcc

CentOS/RHEL

yumインストールgcc-c ++ python-devel.x86_64 cyrus-sasl-devel.x86_64

18
Wyatt

私は同様のエラーを抱えていました-

In file included from sasl/saslwrapper.cpp:254:0:
sasl/saslwrapper.h:22:23: fatal error: sasl/sasl.h: No such file or directory
#include <sasl/sasl.h>
                       ^
compilation terminated.
error: command 'gcc' failed with exit status 1

このスレッドを試してみてください python-ldapをインストールできません

0
Dhananjay Mehta