【问题标题】:Python - Installation build wheel error when installing from local directoryPython - 从本地目录安装时安装构建轮错误
【发布时间】:2021-10-22 11:28:21
【问题描述】:

我想从 GitHub 安装一个使用 Cython (https://github.com/mlysy/kalmantv) 的包。我在本地克隆了该软件包,并尝试使用pip install . 安装它后,出现以下错误:

DEPRECATION: A future pip version will change local packages to be built in-place without first copying to a temporary directory. We recommend you use --use-feature=in-tree-build to test your packages with this new behavior before it becomes the default.
   pip 21.3 will remove support for this functionality. You can find discussion regarding this at https://github.com/pypa/pip/issues/7555.
Processing /Users/me/Downloads/kalmantv
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  ERROR: Command errored out with exit status 1:
   command: /Users/me/.pyenv/versions/3.8.3/bin/python3.8 /Users/me/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/g1/0pjsd_bs24jgccrd6g0lzfvc0000gn/T/tmpxmrdlgnk
       cwd: /Users/me/Downloads/kalmantv
  Complete output (6 lines):
  running egg_info
  writing kalmantv.egg-info/PKG-INFO
  writing dependency_links to kalmantv.egg-info/dependency_links.txt
  writing requirements to kalmantv.egg-info/requires.txt
  writing top-level names to kalmantv.egg-info/top_level.txt
  error: package directory 'eigen-3.3.7' does not exist
  ----------------------------------------
WARNING: Discarding file:///Users/me/Downloads/kalmantv. Command errored out with exit status 1: /Users/me/.pyenv/versions/3.8.3/bin/python3.8 /Users/me/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/g1/0pjsd_bs24jgccrd6g0lzfvc0000gn/T/tmpxmrdlgnk Check the logs for full command output.
ERROR: Command errored out with exit status 1: /Users/me/.pyenv/versions/3.8.3/bin/python3.8 /Users/me/.pyenv/versions/3.8.3/lib/python3.8/site-packages/pip/_vendor/pep517/in_process/_in_process.py get_requires_for_build_wheel /var/folders/g1/0pjsd_bs24jgccrd6g0lzfvc0000gn/T/tmpxmrdlgnk Check the logs for full command output.

我尝试从弃用警告中添加--use-feature=in-tree-build,但仍然出现错误(没有初始警告)。

我看到了许多建议,例如使用 pip install --upgrade pip setuptools wheel,但没有任何效果。我猜这有一个简单的解决方法,但是这东西有点过头了,我不想破坏其他任何东西。

我需要做些什么来安全地纠正这个问题而不引起其他问题?

【问题讨论】:

    标签: python github pip cython


    【解决方案1】:

    setup.py 文件包含以下几行:

    # path to eigen library
    EIGEN_PATH = r"eigen-3.3.7"
    

    奇怪的是,似乎期望 Eigen 头库出现在该位置。您可以使用brew install eigensudo apt install libeigen3-dev 安装库。请注意,这可能不会安装项目期望的库的 3.3.7 版本。我不知道使用较新的版本是否会导致任何问题。

    如果您想安装 3.3.7 版本,您可以通过以下链接从源代码构建和安装它,并关注 these instructions:

    https://gitlab.com/libeigen/eigen/-/releases/3.3.7

    完成后,切换到项目目录,并创建一个指向 Eigen 库的符号链接:

    如果使用 brew 安装:ln -s /usr/local/Cellar/eigen/*/include/eigen3 eigen-3.3.7

    如果使用 apt 安装:ln -s /usr/include/eigen3 eigen-3.3.7

    如果从源安装:/usr/local/include/eigen3 eigen-3.3.7

    一旦 Eigen 库安装并在 ./eigen-3.3.7 可用,pip install . 应该可以工作,但为了更好的措施,您应该首先运行以下命令:

    pip install -U pip setuptools wheel; pip install -U cython
    

    如果遇到如下错误,请参阅Catalina C++: Using <cmath> headers yield error: no member named 'signbit' in the global namespaceerror: no member named 'signbit' in the global namespace

    【讨论】:

    • 使用 brew 安装后出现一堆错误。我正在尝试这个:stackoverflow.com/questions/64745768/…(来源:gitlab.com/libeigen/eigen/-/releases/3.3.7)并得到相同的错误,这似乎是版本问题,但这里有一个例子:In file included from eigen-3.3.7/Eigen/src/Core/util/Macros.h:679: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/cmath:317:9: error: no member named 'signbit' in the global namespace
    • @SuperCodeBrah 这似乎与这个问题有关。这个问题是关于为什么pip install . 给你error: package directory 'eigen-3.3.7' does not exist,已经完全回答了。请参阅stackoverflow.com/questions/58628377 获取解决方案,或者如果您的新问题与我刚刚链接的问题明显不同(以及本网站上的其他类似问题),请提出另一个问题。
    猜你喜欢
    • 2021-10-31
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-01-28
    • 1970-01-01
    • 2021-07-08
    • 2022-10-24
    相关资源
    最近更新 更多