繁体   English   中英

安装 Scipy 时元数据生成失败

[英]metadata-generation-failed while installing Scipy

我一直在尝试安装 Scipy,但出现了一个名为metadata-generation-failed的错误,我来到 stackoverflow 寻找解决方案,但没有一个对我有用。 既不更新 pip,也不使用诸如--use-deprecated=legacy-resolver--use-deprecated=backtrack-on-build-failures命令。 我的想法用完了,如果有人可以提供帮助,我将不胜感激。 代码就在下面:

`

Collecting scipy
  Using cached scipy-1.9.3.tar.gz (42.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [75 lines of output]
      The Meson build system
      Version: 0.64.1
      Source dir: /private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-install-6luprtwk/scipy
      Build dir: /private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-install-6luprtwk/scipy/.mesonpy-be8nnvg4/build
      Build type: native build
      Project name: SciPy
      Project version: 1.9.3
      C compiler for the host machine: cc (clang 12.0.5 "Apple clang version 12.0.5 (clang-1205.0.22.11)")
      C linker for the host machine: cc ld64 650.9
      C++ compiler for the host machine: c++ (clang 12.0.5 "Apple clang version 12.0.5 (clang-1205.0.22.11)")
      C++ linker for the host machine: c++ ld64 650.9
      Host machine cpu family: aarch64
      Host machine cpu: aarch64
      Compiler for C supports arguments -Wno-unused-but-set-variable: NO
      Compiler for C supports arguments -Wno-unused-but-set-variable: NO (cached)
      Compiler for C supports arguments -Wno-unused-function: YES
      Compiler for C supports arguments -Wno-conversion: YES
      Compiler for C supports arguments -Wno-misleading-indentation: YES
      Compiler for C supports arguments -Wno-incompatible-pointer-types: YES
      Library m found: YES
      
      ../../meson.build:57:0: ERROR: Unknown compiler(s): [['gfortran'], ['flang'], ['nvfortran'], ['pgfortran'], ['ifort'], ['ifx'], ['g95']]
      The following exception(s) were encountered:
      Running `gfortran --version` gave "[Errno 2] No such file or directory: 'gfortran'"
      Running `gfortran -V` gave "[Errno 2] No such file or directory: 'gfortran'"
      Running `flang --version` gave "[Errno 2] No such file or directory: 'flang'"
      Running `flang -V` gave "[Errno 2] No such file or directory: 'flang'"
      Running `nvfortran --version` gave "[Errno 2] No such file or directory: 'nvfortran'"
      Running `nvfortran -V` gave "[Errno 2] No such file or directory: 'nvfortran'"
      Running `pgfortran --version` gave "[Errno 2] No such file or directory: 'pgfortran'"
      Running `pgfortran -V` gave "[Errno 2] No such file or directory: 'pgfortran'"
      Running `ifort --version` gave "[Errno 2] No such file or directory: 'ifort'"
      Running `ifort -V` gave "[Errno 2] No such file or directory: 'ifort'"
      Running `ifx --version` gave "[Errno 2] No such file or directory: 'ifx'"
      Running `ifx -V` gave "[Errno 2] No such file or directory: 'ifx'"
      Running `g95 --version` gave "[Errno 2] No such file or directory: 'g95'"
      Running `g95 -V` gave "[Errno 2] No such file or directory: 'g95'"
      
      A full log can be found at /private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-install-6luprtwk/scipy/.mesonpy-be8nnvg4/build/meson-logs/meson-log.txt
      + meson setup --prefix=/Library/Frameworks/Python.framework/Versions/3.10 /private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-install-6luprtwk/scipy /private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-install-6luprtwk/scipy/.mesonpy-be8nnvg4/build --native-file=/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-install-6luprtwk/scipy/.mesonpy-native-file.ini -Ddebug=false -Doptimization=2
      Traceback (most recent call last):
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 144, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
      AttributeError: module 'mesonpy' has no attribute 'prepare_metadata_for_build_wheel'
      
      During handling of the above exception, another exception occurred:
      
      Traceback (most recent call last):
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 351, in <module>
          main()
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pip/_vendor/pep517/in_process/_in_process.py", line 148, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-build-env-5s9erroi/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 1060, in build_wheel
          with _project(config_settings) as project:
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in __enter__
          return next(self.gen)
        File "/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-build-env-5s9erroi/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 975, in _project
          with Project.with_temp_working_dir(
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/contextlib.py", line 135, in __enter__
          return next(self.gen)
        File "/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-build-env-5s9erroi/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 750, in with_temp_working_dir
          yield cls(source_dir, tmpdir, build_dir, meson_args)
        File "/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-build-env-5s9erroi/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 632, in __init__
          self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
        File "/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-build-env-5s9erroi/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 680, in _configure
          self._meson('setup', *setup_args)
        File "/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-build-env-5s9erroi/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 657, in _meson
          return self._proc('meson', *args)
        File "/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-build-env-5s9erroi/overlay/lib/python3.10/site-packages/mesonpy/__init__.py", line 652, in _proc
          subprocess.check_call(list(args), env=self._env)
        File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/subprocess.py", line 369, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['meson', 'setup', '--prefix=/Library/Frameworks/Python.framework/Versions/3.10', '/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-install-6luprtwk/scipy', '/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-install-6luprtwk/scipy/.mesonpy-be8nnvg4/build', '--native-file=/private/var/folders/sy/vl408hcx0d11wftbc8rshy9r0000gn/T/pip-install-6luprtwk/scipy/.mesonpy-native-file.ini', '-Ddebug=false', '-Doptimization=2']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> scipy

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

`

我尝试使用诸如--use-deprecated=legacy-resolver--use-deprecated=backtrack-on-build-failures命令,我在本页的几个案例中发现了这些命令,希望能解决我的问题并最终安装图书馆,但没有一个有效,我总是得到相同的结果:

`

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> scipy

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

`

您是否尝试在 macOS 11 上安装 scipy。如果是这样,那么我们不支持该版本的 macOS 上的 scipy。 对于 M1 车轮,您需要使用 macOS 12 或更高版本。 我认为英特尔在 macOS 11 上没问题。如果您尝试从源代码安装 scipy,则需要安装各种软件包进行安装,缺少 gfortran 是导致此错误的原因。

我有同样的问题,我使用的是 Windows 11。这是我得到的:

Collecting scipy
  Using cached scipy-1.9.3.tar.gz (42.1 MB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Installing backend dependencies ... done
  Preparing metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [83 lines of output]
      + meson setup --prefix=C:\Users\Samuel\AppData\Local\Programs\Python\Python38-32 C:\Users\Samuel\AppData\Local\Temp\pip-install-w
vt0o87d\scipy_4e4216465c1a4897bb68a5e8bfd6a452 C:\Users\Samuel\AppData\Local\Temp\pip-install-wvt0o87d\scipy_4e4216465c1a4897bb68a5e8bf
d6a452\.mesonpy-6vhpgtun\build --native-file=C:\Users\Samuel\AppData\Local\Temp\pip-install-wvt0o87d\scipy_4e4216465c1a4897bb68a5e8bfd6a452\.mesonpy-native-file.ini -Ddebug=false -Doptimization=2
      Traceback (most recent call last):
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\mesonmain.py", line 194, in run
          return options.run_func(options)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\msetup.py", line 307, in run
          app.generate()
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\msetup.py", line 186, in generate
          self._generate(env)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\msetup.py", line 208, in _generate
          intr = interpreter.Interpreter(b, user_defined_options=user_defined_options)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\interpreter\interpreter.py", line 346, in __init__
          self.parse_project()
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\interpreterbase\interpreterbase.py", line 119, in parse_project
          self.evaluate_codeblock(self.ast, end=1)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\interpreterbase\interpreterbase.py", line 174, in evaluate_codeblock
          raise e
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\interpreterbase\interpreterbase.py", line 167, in evaluate_codeblock
          self.evaluate_statement(cur)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\interpreterbase\interpreterbase.py", line 180, in evaluate_statement
          return self.function_call(cur)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\interpreterbase\interpreterbase.py", line 462, in function_call
          res = func(node, func_args, kwargs)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\interpreterbase\decorators.py", line 277, in wrapper
          return f(*nargs, **wrapped_kwargs)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\interpreterbase\decorators.py", line 581, in wrapper
          return f(*wrapped_args, **wrapped_kwargs)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\interpreter\interpreter.py", line 1260, in func_project
          if mesonlib.setup_vsenv(force_vsenv):
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\utils\vsenv.py", line 116, in setup_vsenv
          return _setup_vsenv(force)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonbuild\utils\vsenv.py", line 55, in _setup_vsenv
          bat_json = subprocess.check_output(
        File "C:\Users\Samuel\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 411, in check_output
          return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
        File "C:\Users\Samuel\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 512, in run
          raise CalledProcessError(retcode, process.args,
      subprocess.CalledProcessError: Command '['C:\\Program Files (x86)\\Microsoft Visual Studio\\Installer\\vswhere.exe', '-latest', '
-prerelease', '-requiresAny', '-requires', 'Microsoft.VisualStudio.Component.VC.Tools.x86.x64', '-requires', 'Microsoft.VisualStudio.Workload.WDExpress', '-products', '*', '-utf8', '-format', 'json']' returned non-zero exit status 87.
      The Meson build system
      Version: 0.64.1
      Source dir: C:\Users\Samuel\AppData\Local\Temp\pip-install-wvt0o87d\scipy_4e4216465c1a4897bb68a5e8bfd6a452
      Build dir: C:\Users\Samuel\AppData\Local\Temp\pip-install-wvt0o87d\scipy_4e4216465c1a4897bb68a5e8bfd6a452\.mesonpy-6vhpgtun\build
      Build type: native build
      Project name: SciPy
      Project version: 1.9.3

      ..\..\meson.build:1:0: ERROR: Unhandled python exception

          This is a Meson bug and should be reported!
      Traceback (most recent call last):
        File "C:\Users\Samuel\Documents\GitHub\Ex1\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 144, in prepare_metadata_for_build_wheel
          hook = backend.prepare_metadata_for_build_wheel
      AttributeError: module 'mesonpy' has no attribute 'prepare_metadata_for_build_wheel'

      During handling of the above exception, another exception occurred:

      Traceback (most recent call last):
        File "C:\Users\Samuel\Documents\GitHub\Ex1\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 351, in <module>
          main()
        File "C:\Users\Samuel\Documents\GitHub\Ex1\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 333, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
        File "C:\Users\Samuel\Documents\GitHub\Ex1\venv\lib\site-packages\pip\_vendor\pep517\in_process\_in_process.py", line 148, in prepare_metadata_for_build_wheel
          whl_basename = backend.build_wheel(metadata_directory, config_settings)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonpy\__init__.py", line 1060, in build_wheel
          with _project(config_settings) as project:
        File "C:\Users\Samuel\AppData\Local\Programs\Python\Python38-32\lib\contextlib.py", line 113, in __enter__
          return next(self.gen)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonpy\__init__.py", line 975, in _project
          with Project.with_temp_working_dir(
        File "C:\Users\Samuel\AppData\Local\Programs\Python\Python38-32\lib\contextlib.py", line 113, in __enter__
          return next(self.gen)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonpy\__init__.py", line 750, in with_temp_working_dir
          yield cls(source_dir, tmpdir, build_dir, meson_args)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonpy\__init__.py", line 632, in __init__
          self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonpy\__init__.py", line 680, in _configure
          self._meson('setup', *setup_args)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonpy\__init__.py", line 657, in _meson
          return self._proc('meson', *args)
        File "C:\Users\Samuel\AppData\Local\Temp\pip-build-env-ssxu2cwx\overlay\Lib\site-packages\mesonpy\__init__.py", line 652, in _proc
          subprocess.check_call(list(args), env=self._env)
        File "C:\Users\Samuel\AppData\Local\Programs\Python\Python38-32\lib\subprocess.py", line 364, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['meson', 'setup', '--prefix=C:\\Users\\Samuel\\AppData\\Local\\Programs\\Python\\Python3
8-32', 'C:\\Users\\Samuel\\AppData\\Local\\Temp\\pip-install-wvt0o87d\\scipy_4e4216465c1a4897bb68a5e8bfd6a452', 'C:\\Users\\Samuel\\App
Data\\Local\\Temp\\pip-install-wvt0o87d\\scipy_4e4216465c1a4897bb68a5e8bfd6a452\\.mesonpy-6vhpgtun\\build', '--native-file=C:\\Users\\S
amuel\\AppData\\Local\\Temp\\pip-install-wvt0o87d\\scipy_4e4216465c1a4897bb68a5e8bfd6a452\\.mesonpy-native-file.ini', '-Ddebug=false', '-Doptimization=2']' returned non-zero exit status 2.
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM