I’ve been trying to install fastai to Python 3.11.8 so I could access fastai.vision.all (my code editor is Visual Studio Code) However, after using "python -m pip install fastai", I recieved an subprocess.CalledProcessError, stating "This error originates from a subprocess, and it’s likely not a problem with pip.
Here’s the full error message I got from the terminal:
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:UsersUserPCAppDataLocalTemppip-install-lfh_uajvscipy_0c2595c1abca45c9840a4fe284f06c6a
Build dir: C:UsersUserPCAppDataLocalTemppip-install-lfh_uajvscipy_0c2595c1abca45c9840a4fe284f06c6a.mesonpy-qppxu250build
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:UsersUserPCAppDataLocalTemppip-install-lfh_uajvscipy_0c2595c1abca45c9840a4fe284f06c6a.mesonpy-qppxu250buildmeson-logsmeson-log.txt
+ meson setup --native-file=C:UsersUserPCAppDataLocalTemppip-install-lfh_uajvscipy_0c2595c1abca45c9840a4fe284f06c6a.mesonpy-native-file.ini -Ddebug=false -Doptimization=2 --prefix=C:UsersUserPCAppDataLocalProgramsPythonPython311 C:UsersUserPCAppDataLocalTemppip-install-lfh_uajvscipy_0c2595c1abca45c9840a4fe284f06c6a C:UsersUserPCAppDataLocalTemppip-install-lfh_uajvscipy_0c2595c1abca45c9840a4fe284f06c6a.mesonpy-qppxu250build
Traceback (most recent call last):
File "C:UsersUserPCAppDataLocalProgramsPythonPython311Libsite-packagespip_vendorpyproject_hooks_in_process_in_process.py", line 353, in <module>
main()
File "C:UsersUserPCAppDataLocalProgramsPythonPython311Libsite-packagespip_vendorpyproject_hooks_in_process_in_process.py", line 335, in main
json_out['return_val'] = hook(**hook_input['kwargs'])
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersUserPCAppDataLocalProgramsPythonPython311Libsite-packagespip_vendorpyproject_hooks_in_process_in_process.py", line 118, in get_requires_for_build_wheel
return hook(config_settings)
^^^^^^^^^^^^^^^^^^^^^
File "C:UsersUserPCAppDataLocalTemppip-build-env-zzmgqcftoverlayLibsite-packagesmesonpy__init__.py", line 969, in get_requires_for_build_wheel
with _project(config_settings) as project:
File "C:UsersUserPCAppDataLocalProgramsPythonPython311Libcontextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "C:UsersUserPCAppDataLocalTemppip-build-env-zzmgqcftoverlayLibsite-packagesmesonpy__init__.py", line 948, in _project
with Project.with_temp_working_dir(
File "C:UsersUserPCAppDataLocalProgramsPythonPython311Libcontextlib.py", line 137, in __enter__
return next(self.gen)
^^^^^^^^^^^^^^
File "C:UsersUserPCAppDataLocalTemppip-build-env-zzmgqcftoverlayLibsite-packagesmesonpy__init__.py", line 777, in with_temp_working_dir
yield cls(source_dir, tmpdir, build_dir)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersUserPCAppDataLocalTemppip-build-env-zzmgqcftoverlayLibsite-packagesmesonpy__init__.py", line 682, in __init__
self._configure(reconfigure=bool(build_dir) and not native_file_mismatch)
File "C:UsersUserPCAppDataLocalTemppip-build-env-zzmgqcftoverlayLibsite-packagesmesonpy__init__.py", line 713, in _configure
self._meson(
File "C:UsersUserPCAppDataLocalTemppip-build-env-zzmgqcftoverlayLibsite-packagesmesonpy__init__.py", line 696, in _meson
return self._proc('meson', *args)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:UsersUserPCAppDataLocalTemppip-build-env-zzmgqcftoverlayLibsite-packagesmesonpy__init__.py", line 691, in _proc
subprocess.check_call(list(args))
File "C:UsersUserPCAppDataLocalProgramsPythonPython311Libsubprocess.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.
I’ve tried to upgrade pip as well as installing both setuptools wheel and scipy, but none have worked. I’m not sure if it’s because of the version of fastai and scipy not being complatible with the version of Python. Any advice would be appreciated.
2
Answers
The exception seems to be generated by the
mesonpy
package , which is a wrapper around the meson build system. To installfastai
from source, you need a working C compiler such asgcc
,clang
,cl
(comes with C/C++ SDK of Visual Studio). Install any of these compilers and have them added to thePATH
environment variable.This meson error is complaining that it can’t build SciPy from source. There are a few ways you can solve this problem.
Use pre-compiled binaries
The simplest way would be to use pre-compiled binaries. Reading the list of released builds on PyPi, the first SciPy version to have a pre-compiled wheel compatible with Python 3.11 is SciPy 1.10.1. You could also use the latest version of SciPy, 1.14.1, which is also compatible with Python 3.11.
Compile your own
If you are using a platform which does not have pre-compiled binaries, you can work around this by compiling your own. I recommend consulting the Building from Source documentation. It explains how to install a compiler which is known to work with SciPy.