【问题标题】:PIP Install uamqp on a RaspberryPiPIP 在树莓派上安装 uamqp
【发布时间】:2022-01-17 10:47:23
【问题描述】:

我在尝试使用图像 python:3.10.1-buster 在 RaspberryPi 上运行的 Docker 容器上安装包 azure-eventhub 时遇到问题。问题(据我所知)不在于 azure-eventhub 包,而是依赖于 uamqp 之一。

我的 Dockerfile(其中的一部分)如下所示:

ROM python:3.10.1-buster
WORKDIR /usr/src/app
RUN pip install --upgrade pip
RUN pip install uamqp==1.5.1
RUN pip install azure-eventhub

我也尝试将它添加到我的 Dockerfile 中,但没有任何区别:

RUN apt install -y libxml2-dev libz-dev python-dev python3-dev build-essential

然后我得到的错误是:

ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-_59w4hrm/uamqp_1c72baf900324ec6bf3230a15fef7884/setup.py'"'"'; __file__='"'"'/tmp/pip-install-_59w4hrm/uamqp_1c72baf900324ec6bf3230a15fef7884/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-e1c5r5_w/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.10/uamqp Check the logs for full command output.

以前有人经历过吗?是否可以在 RaspberryPi 上运行 uamqp? - 看这里应该是可能的 - https://pypi.org/project/uamqp/。由于我对 pip 的了解非常有限,Buster 的 .whl 应该存在,并且不需要从源代码构建它?

完整的错误信息是:

ERROR: Failed building wheel for uamqp
Running setup.py clean for uamqp
Failed to build uamqp
Installing collected packages: six, certifi, uamqp
    Running setup.py install for uamqp: started
    Running setup.py install for uamqp: finished with status 'error'
    ERROR: Command errored out with exit status 1:
     command: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wwy1yi07/uamqp_4f9f8d7115bb406f8fbd7b4f40cfc01c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wwy1yi07/uamqp_4f9f8d7115bb406f8fbd7b4f40cfc01c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-i2ybrfl_/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.10/uamqp
         cwd: /tmp/pip-install-wwy1yi07/uamqp_4f9f8d7115bb406f8fbd7b4f40cfc01c/
    Complete output (81 lines):
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-armv7l-3.10
    creating build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/errors.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/connection.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/sender.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/utils.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/compat.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/address.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/constants.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/message.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/mgmt_operation.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/types.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/client.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/receiver.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/__init__.py -> build/lib.linux-armv7l-3.10/uamqp
    copying uamqp/session.py -> build/lib.linux-armv7l-3.10/uamqp
    creating build/lib.linux-armv7l-3.10/uamqp/async_ops
    copying uamqp/async_ops/utils.py -> build/lib.linux-armv7l-3.10/uamqp/async_ops
    copying uamqp/async_ops/receiver_async.py -> build/lib.linux-armv7l-3.10/uamqp/async_ops
    copying uamqp/async_ops/mgmt_operation_async.py -> build/lib.linux-armv7l-3.10/uamqp/async_ops
    copying uamqp/async_ops/client_async.py -> build/lib.linux-armv7l-3.10/uamqp/async_ops
    copying uamqp/async_ops/sender_async.py -> build/lib.linux-armv7l-3.10/uamqp/async_ops
    copying uamqp/async_ops/session_async.py -> build/lib.linux-armv7l-3.10/uamqp/async_ops
    copying uamqp/async_ops/__init__.py -> build/lib.linux-armv7l-3.10/uamqp/async_ops
    copying uamqp/async_ops/connection_async.py -> build/lib.linux-armv7l-3.10/uamqp/async_ops
    creating build/lib.linux-armv7l-3.10/uamqp/authentication
    copying uamqp/authentication/cbs_auth.py -> build/lib.linux-armv7l-3.10/uamqp/authentication
    copying uamqp/authentication/cbs_auth_async.py -> build/lib.linux-armv7l-3.10/uamqp/authentication
    copying uamqp/authentication/common.py -> build/lib.linux-armv7l-3.10/uamqp/authentication
    copying uamqp/authentication/__init__.py -> build/lib.linux-armv7l-3.10/uamqp/authentication
    running egg_info
    writing uamqp.egg-info/PKG-INFO
    writing dependency_links to uamqp.egg-info/dependency_links.txt
    writing requirements to uamqp.egg-info/requires.txt
    writing top-level names to uamqp.egg-info/top_level.txt
    reading manifest file 'uamqp.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'uamqp.egg-info/SOURCES.txt'
    copying uamqp/c_uamqp.c -> build/lib.linux-armv7l-3.10/uamqp
    running build_ext
    will build uamqp in build/temp.linux-armv7l-3.10/cmake
    Building with generator flags: -G "Unix Makefiles"
    calling cmake /tmp/pip-install-wwy1yi07/uamqp_4f9f8d7115bb406f8fbd7b4f40cfc01c/src/vendor/azure-uamqp-c/ -G "Unix Makefiles" -Duse_openssl:bool=ON -Duse_default_uuid:bool=ON  -Duse_builtin_httpapi:bool=ON  -Dskip_samples:bool=ON -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release
    /bin/sh: 1: cmake: not found
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-wwy1yi07/uamqp_4f9f8d7115bb406f8fbd7b4f40cfc01c/setup.py", line 260, in <module>
        setup(
      File "/usr/local/lib/python3.10/site-packages/setuptools/__init__.py", line 153, in setup
        return distutils.core.setup(**attrs)
      File "/usr/local/lib/python3.10/distutils/core.py", line 148, in setup
        dist.run_commands()
      File "/usr/local/lib/python3.10/distutils/dist.py", line 966, in run_commands
        self.run_command(cmd)
      File "/usr/local/lib/python3.10/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.10/site-packages/setuptools/command/install.py", line 61, in run
        return orig.install.run(self)
      File "/usr/local/lib/python3.10/distutils/command/install.py", line 568, in run
        self.run_command('build')
      File "/usr/local/lib/python3.10/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.10/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/usr/local/lib/python3.10/distutils/command/build.py", line 135, in run
        self.run_command(cmd_name)
      File "/usr/local/lib/python3.10/distutils/cmd.py", line 313, in run_command
        self.distribution.run_command(command)
      File "/usr/local/lib/python3.10/distutils/dist.py", line 985, in run_command
        cmd_obj.run()
      File "/tmp/pip-install-wwy1yi07/uamqp_4f9f8d7115bb406f8fbd7b4f40cfc01c/setup.py", line 134, in run
        self.build_cmake(ext)
      File "/tmp/pip-install-wwy1yi07/uamqp_4f9f8d7115bb406f8fbd7b4f40cfc01c/setup.py", line 183, in build_cmake
        subprocess.check_call(joined_cmd, shell=True, universal_newlines=True, env=build_env)
      File "/usr/local/lib/python3.10/subprocess.py", line 369, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command 'cmake /tmp/pip-install-wwy1yi07/uamqp_4f9f8d7115bb406f8fbd7b4f40cfc01c/src/vendor/azure-uamqp-c/ -G "Unix Makefiles" -Duse_openssl:bool=ON -Duse_default_uuid:bool=ON  -Duse_builtin_httpapi:bool=ON  -Dskip_samples:bool=ON -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE -DCMAKE_BUILD_TYPE=Release' returned non-zero exit status 127.
    ----------------------------------------
ERROR: Command errored out with exit status 1: /usr/local/bin/python -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-wwy1yi07/uamqp_4f9f8d7115bb406f8fbd7b4f40cfc01c/setup.py'"'"'; __file__='"'"'/tmp/pip-install-wwy1yi07/uamqp_4f9f8d7115bb406f8fbd7b4f40cfc01c/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-i2ybrfl_/install-record.txt --single-version-externally-managed --compile --install-headers /usr/local/include/python3.10/uamqp Check the logs for full command output.

提前谢谢你:)

【问题讨论】:

  • 你能分享更多的错误信息吗?那部分主要是说安装命令失败。
  • 是的,当然 - 抱歉,我认为这是相关的部分。我已经更新了完整的错误消息。
  • /bin/sh: 1: cmake: not found RUN apt install -y cmake
  • 谢谢@FlyingTeller!这是一种享受——现在你已经指出了这一点,这很明显。非常感谢您的快速帮助。
  • 太好了,我会把它作为答案发布

标签: python pip raspbian-buster


【解决方案1】:

在错误信息中,我们可以看到

/bin/sh: 1: cmake: not found

所以你缺少cmake,你应该可以使用它来安装

RUN apt install -y cmake

【讨论】:

    【解决方案2】:

    正如uamqp 解释的那样,如果您运行的 Linux 发行版不支持 ManyLinux1,或者您需要根据您的系统设置和软件包自定义构建,您可以从源代码安装:

    $ apt-get update
    $ apt-get install -y build-essential libssl-dev uuid-dev cmake libcurl4-openssl-dev pkg-config python3-dev python3-pip
    $ pip3 install uamqp --no-binary :all:
    

    因此,您必须在 docker 文件中包含以下命令行。

    RUN apt-get install -y cmake && \
        apt-get install -y build-essential && \
        apt-get install -y libssl-dev && \
        apt-get install -y uuid-dev && \
        apt-get install -y libcurl4-openssl-dev && \
        apt-get install -y pkg-config
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2022-01-24
      • 2020-04-15
      • 2016-12-11
      • 2021-01-18
      • 1970-01-01
      • 2021-12-01
      • 2015-12-10
      • 2021-01-23
      相关资源
      最近更新 更多