【问题标题】:python buildpack - fatal error: sasl/sasl.h: No such file or directorypython buildpack - 致命错误:sasl/sasl.h:没有这样的文件或目录
【发布时间】:2017-10-10 16:01:12
【问题描述】:

在我的 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.

我正在使用 buildpack:python 1.5.5

我的 runtime.txt 包含:python-3.5.0

如何在 buildpack 中安装必要的标头?


更新:

看起来最新的云铸造堆栈具有 sasl 库:https://github.com/cloudfoundry/cflinuxfs2/blob/1.119.0/cflinuxfs2/build/install-packages.sh#L98

如何在 Bluemix 上使用这个堆栈?

【问题讨论】:

  • 很遗憾,您无法控制堆栈的版本,您只需要等待 Bluemix 更新他们的版本即可。
  • 感谢您的更新。它鼓励我为我的应用程序寻找解决方法,我设法解决了这个问题。

标签: python ibm-cloud cloud-foundry buildpack


【解决方案1】:

我的解决方案是使用 pure-sasl 并从应用程序代码而不是我的 requirements.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'])

我将此代码添加到我的烧瓶应用程序的视图中:https://github.com/snowch/movie-recommender-demo/blob/master/web_app/app/main/views.py

【讨论】:

    【解决方案2】:

    也许你应该先安装一些系统库才能安装sasl参考https://pypi.python.org/pypi/sasl/0.1.3

    这个库包含 C++ 代码,需要一些额外的 已安装系统库。

    Debian/Ubuntu

    apt-get install python-dev libsasl2-dev gcc

    CentOS/RHEL

    yum install gcc-c++ python-devel.x86_64 cyrus-sasl-devel.x86_64

    【讨论】:

    • 我试图在 ubuntu 环境中安装 sasl。它显示了 OP 的错误。然后我尝试了apt-get install -y libsasl2-dev gcc python-dev。然后安装pip install sasl==0.2.1,不再报错
    • 这个解决方案 apt-get install -y libsasl2-dev gcc python-dev 也为我工作。非常感谢
    • 该解决方案适用于我在 Linux RHEL 7.5 上。谢谢!!
    • 该解决方案解决了我安装pip3 install 'apache-airflow[devel_hadoop]'的问题。 :)
    【解决方案3】:

    我遇到了类似的错误 -

    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
    

    试试这个帖子,它对我很有帮助 I can't install python-ldap

    【讨论】:

    • 感谢您的回答。不幸的是,在 Cloud Foundry 应用程序上,您无法运行操作系统包管理器来安装所需的库。
    猜你喜欢
    • 2018-07-11
    • 2020-04-13
    • 2017-05-09
    • 2021-05-15
    • 2014-10-31
    • 2022-01-11
    • 2021-09-19
    • 2016-06-23
    相关资源
    最近更新 更多