Skip to content

BUG: Meson bug with MinGW detection when trying to install NumPy #25518

@ImVacuous

Description

@ImVacuous

Describe the issue:

I've encountered an error when trying to install NumPy, and I'm unsure on how to resolve it.

Reproduce the code example:

pip install numpy

Error message:

C:\Windows\System32>pip install numpy
Collecting numpy
  Using cached numpy-1.26.2.tar.gz (15.7 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
  ╰─> [82 lines of output]
      + C:\msys64\mingw64\bin\python.exe C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\meson.py setup C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\.mesonpy-lkzgy495\build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\.mesonpy-lkzgy495\build\meson-python-native-file.ini
      Traceback (most recent call last):
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\mesonmain.py", line 194, in run
          return options.run_func(options)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\msetup.py", line 358, in run
          app.generate()
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\msetup.py", line 183, in generate
          return self._generate(env, capture, vslite_ctx)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\msetup.py", line 228, in _generate
          intr.run()
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreter\interpreter.py", line 3002, in run
          super().run()
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 164, in run
          self.evaluate_codeblock(self.ast, start=1)
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 190, in evaluate_codeblock
          raise e
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 182, in evaluate_codeblock
          self.evaluate_statement(cur)
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 198, in evaluate_statement
          self.assignment(cur)
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 635, in assignment
          value = self.evaluate_statement(node.value)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 200, in evaluate_statement
          return self.method_call(cur)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\interpreterbase.py", line 550, in method_call
          res = obj.method_call(method_name, args, kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\baseobjects.py", line 94, in method_call
          return method(args, kwargs)
                 ^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\decorators.py", line 109, in wrapped
          ret = f(*wrapped_args, **wrapped_kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\decorators.py", line 127, in wrapped
          return f(*wrapped_args, **wrapped_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\decorators.py", line 826, in wrapped
          return f(*wrapped_args, **wrapped_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\interpreterbase\decorators.py", line 64, in wrapped
          return f(*wrapped_args, **wrapped_kwargs)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\modules\python.py", line 204, in dependency_method
          dep = self._dependency_method_impl(kwargs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\modules\python.py", line 189, in _dependency_method_impl
          dep = find_external_dependency('python', self.interpreter.environment, new_kwargs, candidates)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\dependencies\detect.py", line 124, in find_external_dependency
          d = c()
              ^^^
        File "C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\vendored-meson\meson\mesonbuild\dependencies\python.py", line 224, in __init__
          if mesonlib.is_windows() and self.get_windows_python_arch().endswith('64') and mesonlib.version_compare(self.version, '<3.12'):
                                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      AttributeError: 'NoneType' object has no attribute 'endswith'
      The Meson build system
      Version: 1.2.99
      Source dir: C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe
      Build dir: C:\Users\phoen\AppData\Local\Temp\pip-install-z1fs9fca\numpy_21f5ced3a51e4686ae2ce71389fdd1fe\.mesonpy-lkzgy495\build
      Build type: native build
      Project name: NumPy
      Project version: 1.26.2
      C compiler for the host machine: cc (gcc 13.2.0 "cc (Rev3, Built by MSYS2 project) 13.2.0")
      C linker for the host machine: cc ld.bfd 2.41
      C++ compiler for the host machine: c++ (gcc 13.2.0 "c++ (Rev3, Built by MSYS2 project) 13.2.0")
      C++ linker for the host machine: c++ ld.bfd 2.41
      Cython compiler for the host machine: cython (cython 3.0.7)
      Host machine cpu family: x86_64
      Host machine cpu: x86_64
      Program python found: YES (C:\msys64\mingw64\bin\python.exe)
      Did not find pkg-config by name 'pkg-config'
      Found Pkg-config: NO
      Unknown Windows Python platform 'mingw_x86_64'
      Unknown Windows Python platform 'mingw_x86_64'

      ..\..\meson.build:41:12: 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.
╰─> See above for output.

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

Python and NumPy Versions:

Python 3.11.7

Runtime Environment:

win11

Context for the issue:

I've been trying to install Manim so that I can create mathematical animations, but I encountered an error with NumPy when trying to install it using this command: python -m pip install manim. To resolve it, I just decided to install NumPy individually and came across this error. I'd greatly appreciate it if someone helped me troubleshoot this bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions