Skip to content

Meson fails to build NumPy on Python 3.15.0af with AttributeError: 'NoneType' object has no attribute 'split' #15397

@Nevsor

Description

@Nevsor

Describe the bug
Meson fails to build NumPy on Python 3.15.0af with AttributeError: 'NoneType' object has no attribute 'split'

The error message contains UnicodeDecodeErrors that might be related to Python 3.15 changing the default encoding from "locale" to "utf8" https://docs.python.org/3.15/whatsnew/3.15.html#whatsnew315-utf8-default

To Reproduce

This works: py -3.14 -m pip install numpy==2.3.5
This doesn't: py -3.15.0a3 -m pip install numpy==2.3.5
This works (Powershell): $env:PYTHONUTF8=0; py -3.15.0a3 -m pip install numpy==2.3.5

Expected behavior
Meson builds NumPy without errors.

system parameters

  • Build using pip
  • Windows 11
  • Python 3.15.0a3
  • pip 25.3
  • Meson 1.8.3

Error message:

$py -3.15.0a3 -m pip install numpy
Collecting numpy
  Using cached numpy-2.3.5.tar.gz (20.6 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: 2
  ╰─> [89 lines of output]
      + C:\Users\stes\AppData\Local\Python\pythoncore-3.15-64\python.exe C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\meson.py setup C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204 C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\.mesonpy-bona1k7k -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\.mesonpy-bona1k7k\meson-python-native-file.ini
      Exception in thread Thread-3 (_readerthread):
      Exception in thread Thread-4 (_readerthread):
      Traceback (most recent call last):
        File "C:\Users\stes\AppData\Local\Python\pythoncore-3.15-64\Lib\threading.py", line 1075, in _bootstrap_inner
          self._context.run(self.run)
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^
        File "C:\Users\stes\AppData\Local\Python\pythoncore-3.15-64\Lib\threading.py", line 1017, in run
          self._target(*self._args, **self._kwargs)
          ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\stes\AppData\Local\Python\pythoncore-3.15-64\Lib\subprocess.py", line 1612, in _readerthread
          buffer.append(fh.read())
                        ~~~~~~~^^
      Traceback (most recent call last):
        File "<frozen codecs>", line 325, in decode
        File "C:\Users\stes\AppData\Local\Python\pythoncore-3.15-64\Lib\threading.py", line 1075, in _bootstrap_inner
          self._context.run(self.run)
          ~~~~~~~~~~~~~~~~~^^^^^^^^^^
        File "C:\Users\stes\AppData\Local\Python\pythoncore-3.15-64\Lib\threading.py", line 1017, in run
          self._target(*self._args, **self._kwargs)
          ~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\stes\AppData\Local\Python\pythoncore-3.15-64\Lib\subprocess.py", line 1612, in _readerthread
          buffer.append(fh.read())
                        ~~~~~~~^^
        File "<frozen codecs>", line 325, in decode
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0x81 in position 62: invalid start byte
      UnicodeDecodeError: 'utf-8' codec can't decode byte 0x84 in position 546: invalid start byte
      Traceback (most recent call last):
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\mesonmain.py", line 193, in run
          return options.run_func(options)
                 ~~~~~~~~~~~~~~~~^^^^^^^^^
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\msetup.py", line 390, in run
          app.generate()
          ~~~~~~~~~~~~^^
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\msetup.py", line 192, in generate
          return self._generate(env, capture, vslite_ctx)
                 ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\msetup.py", line 232, in _generate
          intr = interpreter.Interpreter(b, user_defined_options=user_defined_options)
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreter\interpreter.py", line 308, in __init__
          self.parse_project()
          ~~~~~~~~~~~~~~~~~~^^
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 138, in parse_project
          self.evaluate_codeblock(self.ast, end=1)
          ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 203, in evaluate_codeblock
          raise e
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 195, in evaluate_codeblock
          self.evaluate_statement(cur)
          ~~~~~~~~~~~~~~~~~~~~~~~^^^^^
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 209, in evaluate_statement
          return self.function_call(cur)
                 ~~~~~~~~~~~~~~~~~~^^^^^
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 536, in function_call
          res = func(node, func_args, kwargs)
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreterbase\decorators.py", line 237, in wrapper
          return f(*nargs, **wrapped_kwargs)
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreterbase\decorators.py", line 556, in wrapper
          return f(*wrapped_args, **wrapped_kwargs)
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreter\interpreter.py", line 1293, in func_project
          self.add_languages(proj_langs, True, MachineChoice.HOST)
          ~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreter\interpreter.py", line 1477, in add_languages
          success = self.add_languages_for(args, required, for_machine)
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\interpreter\interpreter.py", line 1520, in add_languages_for
          comp = compilers.detect_compiler_for(self.environment, lang, for_machine, skip_sanity_check, self.subproject)
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\compilers\detect.py", line 106, in detect_compiler_for
          comp = compiler_from_language(env, lang, for_machine)
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\compilers\detect.py", line 103, in compiler_from_language
          return lang_map[lang](env, for_machine) if lang in lang_map else None
                 ~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\compilers\detect.py", line 633, in detect_c_compiler
          return _detect_c_or_cpp_compiler(env, 'c', for_machine)
        File "C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\vendored-meson\meson\mesonbuild\compilers\detect.py", line 335, in _detect_c_or_cpp_compiler
          full_version = out.split('\n', 1)[0]
                         ^^^^^^^^^
      AttributeError: 'NoneType' object has no attribute 'split'
      The Meson build system
      Version: 1.8.3
      Source dir: C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204
      Build dir: C:\Users\stes\AppData\Local\Temp\pip-install-5rkwpi51\numpy_f48b46f8cbf84c329989890b4d232204\.mesonpy-bona1k7k
      Build type: native build
      Activating VS 17.14.23
      Project name: NumPy
      Project version: 2.3.5

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

          This is a Meson bug and should be reported!
      [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.
╰─> numpy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions