错误:无法为使用 PEP 517 且无法直接安装的 scipy 构建轮子

Sou*_*brt 64 python pip scipy embedded-linux python-wheel

我正在尝试通过 pip 在我的 64 位 ARMV8 板上安装 scipy。我已经安装了 scipy 所需的 openblas。所以,没有问题。当我给时pip3 install scipy --trusted-host pypi.org --trusted-host files.pythonhosted.org,我收到错误Failed building wheel for scipy。我有 pip3 和 pip3.5,/usr/bin其余的 pip 都在/usr/lib64/python3.5/site-packages。所以基本上,我也有 pip。

我还尝试使用--no-binary选项安装 scipy ,这是网络上的答案之一。但是,它给了我同样的错误。下面是我得到的错误。

错误:

Collecting scipy
  Downloading scipy-1.4.1.tar.gz (24.6 MB)
     |################################| 24.6 MB 6.6 MB/s 
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: scipy
  Building wheel for scipy (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /usr/bin/python3 /usr/lib64/python3.5/site-packages/pip-20.0.2-py3.5.egg/pip/_vendor/pep517/_in_process.py build_wheel /tmp/tmpkklsvv4v
       cwd: /tmp/pip-install-9v4nmof7/scipy
  Complete output (50 lines):
  /usr/bin/python3: No module named pip
  Traceback (most recent call last):
    File "/usr/lib64/python3.5/site-packages/setuptools/installer.py", line 128, in fetch_build_egg
      subprocess.check_call(cmd)
    File "/usr/lib64/python3.5/subprocess.py", line 271, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpp7fvgp36', '--quiet', 'numpy>=1.13.3']' returned non-zero exit status 1

  During handling of the above exception, another exception occurred:

  Traceback (most recent call last):
    File "/usr/lib64/python3.5/site-packages/pip-20.0.2-py3.5.egg/pip/_vendor/pep517/_in_process.py", line 257, in <module>
      main()
    File "/usr/lib64/python3.5/site-packages/pip-20.0.2-py3.5.egg/pip/_vendor/pep517/_in_process.py", line 240, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/usr/lib64/python3.5/site-packages/pip-20.0.2-py3.5.egg/pip/_vendor/pep517/_in_process.py", line 182, in build_wheel
      metadata_directory)
    File "/usr/lib64/python3.5/site-packages/setuptools/build_meta.py", line 213, in build_wheel
      wheel_directory, config_settings)
    File "/usr/lib64/python3.5/site-packages/setuptools/build_meta.py", line 198, in _build_with_temp_dir
      self.run_setup()
    File "/usr/lib64/python3.5/site-packages/setuptools/build_meta.py", line 250, in run_setup
      self).run_setup(setup_script=setup_script)
    File "/usr/lib64/python3.5/site-packages/setuptools/build_meta.py", line 143, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 540, in <module>
      setup_package()
    File "setup.py", line 536, in setup_package
      setup(**metadata)
    File "/usr/lib64/python3.5/site-packages/numpy/distutils/core.py", line 126, in setup
      dist = setup(**new_attr)
    File "/usr/lib64/python3.5/site-packages/numpy/distutils/core.py", line 169, in setup
      return old_setup(**new_attr)
    File "/usr/lib64/python3.5/site-packages/setuptools/__init__.py", line 143, in setup
      _install_setup_requires(attrs)
    File "/usr/lib64/python3.5/site-packages/setuptools/__init__.py", line 138, in _install_setup_requires
      dist.fetch_build_eggs(dist.setup_requires)
    File "/usr/lib64/python3.5/site-packages/setuptools/dist.py", line 698, in fetch_build_eggs
      replace_conflicting=True,
    File "/usr/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 783, in resolve
      replace_conflicting=replace_conflicting
    File "/usr/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 1066, in best_match
      return self.obtain(req, installer)
    File "/usr/lib64/python3.5/site-packages/pkg_resources/__init__.py", line 1078, in obtain
      return installer(requirement)
    File "/usr/lib64/python3.5/site-packages/setuptools/dist.py", line 754, in fetch_build_egg
      return fetch_build_egg(self, req)
    File "/usr/lib64/python3.5/site-packages/setuptools/installer.py", line 130, in fetch_build_egg
      raise DistutilsError(str(e))
  distutils.errors.DistutilsError: Command '['/usr/bin/python3', '-m', 'pip', '--disable-pip-version-check', 'wheel', '--no-deps', '-w', '/tmp/tmpp7fvgp36', '--quiet', 'numpy>=1.13.3']' returned non-zero exit status 1
  ----------------------------------------
  ERROR: Failed building wheel for scipy
Failed to build scipy
ERROR: Could not build wheels for scipy which use PEP 517 and cannot be installed directly
Run Code Online (Sandbox Code Playgroud)

Ahm*_*tob 38

我对 opencv-python 有同样的问题。对我有用的是将 pip 更新为:

pip3 install --upgrade pip
Run Code Online (Sandbox Code Playgroud)

注意:我在 Linux 上使用 docker。


小智 32

我遇到过同样的问题。我在运行以下命令后解决了这个问题

pip install --upgrade pip setuptools wheel
Run Code Online (Sandbox Code Playgroud)

  • 当尝试安装 scipy `1.6.2` 时,这在 Python `3.9.4`、pip `pip 21.0.1`、macOS Big Sur `11.2.3 (20D91)` 上不起作用。仍然遇到同样的错误原始问题 (15认同)
  • 阅读您的错误输出!这应该是这个问题的首选答案 - 因为它允许包管理器进行适当的处​​理。如果仍然失败,可能是因为您只阅读了错误消息的最后一行。就我自己而言,我被一个运行 python2.7(商业)的应用程序困住了,并且由于 Python.h 头文件与版本指针不匹配而不得不安装 python2-dev(旧版本)。 (4认同)
  • 答对了!这对我有用。 (2认同)

mak*_*asi 21

我的问题不在于 scipy,而在于 xmlsec。错误消息几乎相同:

ERROR: Could not build wheels for xmlsec which use PEP 517 and cannot be installed directly
Run Code Online (Sandbox Code Playgroud)

我需要这个库,因为它是 python3-saml 的依赖项。从我读到的文档中,他们首先安装了这些软件包:

sudo apt-get install libxml2-dev libxmlsec1-dev
Run Code Online (Sandbox Code Playgroud)

这样做之后,python3-saml 的安装对我有用。

pip3 -V
pip 20.2.3

python -V
Python 3.8.0b3
Run Code Online (Sandbox Code Playgroud)

可能其他库的答案不同,但它们都需要一些包才能构建,您应该找到适合您的包。


Ben*_*ann 16

这个错误也会出现numpy,如果您使用的是新的 M1 芯片,恐怕您必须以numpy不同的方式安装软件包。看看这个


小智 7

我正在努力使用以下命令通过 Jupyter (Ubuntu) 安装 pandas pip install pandas

无法构建 pandas 错误:无法为使用 PEP 517 且无法直接安装的 pandas 构建轮子

以下是我的解决方案:

pip install --upgrade pip setuptools wheel
Run Code Online (Sandbox Code Playgroud)

然后

pip install pandas -i https://pypi.mirrors.ustc.edu.cn/simple/
Run Code Online (Sandbox Code Playgroud)


小智 6

我遇到了同样的问题。似乎 pip 使用 pkg-config - 如果您的主机操作系统缺少此配置,则会遇到此错误。我通过以下方式解决:

sudo apt-get install -y pkg-config
Run Code Online (Sandbox Code Playgroud)

然后重新运行pip


bwv*_*549 6

我在尝试安装 tidyms 软件包时遇到了这个问题(这取决于 scipy <= 1.4.1)。

就我而言,使用 python 3.8 而不是 python 3.9 “解决”了问题(至少能够安装)。


小智 5

直接做

pip install p5py
pip install PEP517
Run Code Online (Sandbox Code Playgroud)

这将完成工作。

  • 不适合我。我在 Windows 上安装 jq 时遇到此错误。 (2认同)