使用Python安装fastai时出现子进程错误

问题描述 投票:0回答:1

我一直在尝试将fastai安装到Python 3.11.8,以便我可以访问fastai.vision.all(我的代码编辑器是Visual Studio Code)但是,在使用“python -m pip install fastai”之后,我收到了一个子进程。 CalledProcessError,指出“此错误源自子进程,这可能不是 pip 的问题。

这是我从终端收到的完整错误消息:


error: subprocess-exited-with-error



  × Getting requirements to build wheel did not run successfully.

  │ exit code: 1

  ╰─> [55 lines of output]

      The Meson build system

      Version: 0.62.2

      Source dir: C:\Users\UserPC\AppData\Local\Temp\pip-install-lfh_uajv\scipy_0c2595c1abca45c9840a4fe284f06c6a

      Build dir: C:\Users\UserPC\AppData\Local\Temp\pip-install-lfh_uajv\scipy_0c2595c1abca45c9840a4fe284f06c6a\.mesonpy-qppxu250\build

      Build type: native build

      Project name: SciPy

      Project version: 1.9.1

      WARNING: Failed to activate VS environment: Could not parse vswhere.exe output



      ..\..\meson.build:1:0: ERROR: Unknown compiler(s): [['icl'], ['cl'], ['cc'], ['gcc'], ['clang'], ['clang-cl'], ['pgcc']]

      The following exception(s) were encountered:

      Running "icl " gave "[WinError 2] The system cannot find the file specified"

      Running "cl /?" gave "[WinError 2] The system cannot find the file specified"

      Running "cc --version" gave "[WinError 2] The system cannot find the file specified"

      Running "gcc --version" gave "[WinError 2] The system cannot find the file specified"

      Running "clang --version" gave "[WinError 2] The system cannot find the file specified"

      Running "clang-cl /?" gave "[WinError 2] The system cannot find the file specified"

      Running "pgcc --version" gave "[WinError 2] The system cannot find the file specified"



      A full log can be found at C:\Users\UserPC\AppData\Local\Temp\pip-install-lfh_uajv\scipy_0c2595c1abca45c9840a4fe284f06c6a\.mesonpy-qppxu250\build\meson-logs\meson-log.txt

      + meson setup --native-file=C:\Users\UserPC\AppData\Local\Temp\pip-install-lfh_uajv\scipy_0c2595c1abca45c9840a4fe284f06c6a\.mesonpy-native-file.ini -Ddebug=false -Doptimization=2 --prefix=C:\Users\UserPC\AppData\Local\Programs\Python\Python311 C:\Users\UserPC\AppData\Local\Temp\pip-install-lfh_uajv\scipy_0c2595c1abca45c9840a4fe284f06c6a C:\Users\UserPC\AppData\Local\Temp\pip-install-lfh_uajv\scipy_0c2595c1abca45c9840a4fe284f06c6a\.mesonpy-qppxu250\build

      Traceback (most recent call last):

        File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>

          main()

        File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main

          json_out['return_val'] = hook(**hook_input['kwargs'])

                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^

        File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 118, in get_requires_for_build_wheel

          return hook(config_settings)

                 ^^^^^^^^^^^^^^^^^^^^^

        File "C:\Users\UserPC\AppData\Local\Temp\pip-build-env-zzmgqcft\overlay\Lib\site-packages\mesonpy\__init__.py", line 969, in get_requires_for_build_wheel

          with _project(config_settings) as project:

        File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 137, in __enter__

          return next(self.gen)

                 ^^^^^^^^^^^^^^

        File "C:\Users\UserPC\AppData\Local\Temp\pip-build-env-zzmgqcft\overlay\Lib\site-packages\mesonpy\__init__.py", line 948, in _project

          with Project.with_temp_working_dir(

        File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\contextlib.py", line 137, in __enter__

          return next(self.gen)

                 ^^^^^^^^^^^^^^

        File "C:\Users\UserPC\AppData\Local\Temp\pip-build-env-zzmgqcft\overlay\Lib\site-packages\mesonpy\__init__.py", line 777, in with_temp_working_dir

          yield cls(source_dir, tmpdir, build_dir)

                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

        File "C:\Users\UserPC\AppData\Local\Temp\pip-build-env-zzmgqcft\overlay\Lib\site-packages\mesonpy\__init__.py", line 682, in __init__

          self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)

        File "C:\Users\UserPC\AppData\Local\Temp\pip-build-env-zzmgqcft\overlay\Lib\site-packages\mesonpy\__init__.py", line 713, in _configure

          self._meson(

        File "C:\Users\UserPC\AppData\Local\Temp\pip-build-env-zzmgqcft\overlay\Lib\site-packages\mesonpy\__init__.py", line 696, in _meson

          return self._proc('meson', *args)

                 ^^^^^^^^^^^^^^^^^^^^^^^^^^

        File "C:\Users\UserPC\AppData\Local\Temp\pip-build-env-zzmgqcft\overlay\Lib\site-packages\mesonpy\__init__.py", line 691, in _proc

          subprocess.check_call(list(args))

        File "C:\Users\UserPC\AppData\Local\Programs\Python\Python311\Lib\subprocess.py", line 413, in check_call

          raise CalledProcessError(retcode, cmd)

      subprocess.CalledProcessError: Command '['meson', 'setup', '--native-file=C:\\Users\\UserPC\\AppData\\Local\\Temp\\pip-install-lfh_uajv\\scipy_0c2595c1abca45c9840a4fe284f06c6a\\.mesonpy-native-file.ini', '-Ddebug=false', '-Doptimization=2', '--prefix=C:\\Users\\UserPC\\AppData\\Local\\Programs\\Python\\Python311', 'C:\\Users\\UserPC\\AppData\\Local\\Temp\\pip-install-lfh_uajv\\scipy_0c2595c1abca45c9840a4fe284f06c6a', 'C:\\Users\\UserPC\\AppData\\Local\\Temp\\pip-install-lfh_uajv\\scipy_0c2595c1abca45c9840a4fe284f06c6a\\.mesonpy-qppxu250\\build']' 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: subprocess-exited-with-error



× Getting requirements to build wheel did not run successfully.

│ exit code: 1

╰─> See above for output.



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

我尝试升级 pip 以及安装 setuptools Wheel 和 scipy,但没有成功。不知道是不是因为fastai和scipy的版本与Python的版本不兼容。任何建议将不胜感激。

python-3.x scipy fast-ai
1个回答
0
投票

异常似乎是由

mesonpy
包生成的,它是介子构建系统的包装器。要从源代码安装
fastai
,您需要一个可用的 C 编译器,例如
gcc
clang
cl
(附带 Visual Studio 的 C/C++ SDK)。安装这些编译器中的任何一个并将它们添加到
PATH
环境变量中。

© www.soinside.com 2019 - 2024. All rights reserved.