Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ImVacuous opened this issue Jan 2, 2024 · 4 comments · Fixed by #25598
Closed

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

ImVacuous opened this issue Jan 2, 2024 · 4 comments · Fixed by #25598
Labels

Comments

@ImVacuous
Copy link

ImVacuous commented Jan 2, 2024

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.

@ngoldbaum
Copy link
Member

This was fixed upstream in mesonbuild/meson#12586, not sure if numpy 1.26.3 will include a vendored meson with a fix.

@charris
Copy link
Member

charris commented Jan 2, 2024

not sure if numpy 1.26.3

1.26.3 has the same version as main, so maybe.

EDIT: I do plan a 1.26.4 with the hope for a few more f2py fixes.

@eli-schwartz
Copy link

eli-schwartz commented Jan 2, 2024

It probably has to be manually backported -- @rgommers commented in another issue:

The full update to latest Meson master is a bit of a pain. It'll be easier to finish upstreaming some stuff so we get fewer merge conflicts.

There are probably other fixes that matter for numpy's build, so... fingers crossed that those pieces are ready for upstreaming soon.

@rgommers
Copy link
Member

rgommers commented Jan 2, 2024

Ah, I'll see if we can include this fix.

fingers crossed that those pieces are ready for upstreaming soon.

Working on it right now for BLAS/LAPACK - finding some interesting surprises on the way. Everything works unchanged on SciPy (which tells me things are mature now), except when symbol suffixes are used (e.g. Apple Accelerate). The Meson code is still fine I think, but it's hard to be sure without sorting out the mess on the SciPy side.

@rgommers rgommers changed the title BUG: Meson bug when trying to install NumPy BUG: Meson bug with MinGW detection when trying to install NumPy Jan 16, 2024
rgommers added a commit to rgommers/numpy that referenced this issue Jan 16, 2024
charris pushed a commit to charris/numpy that referenced this issue Jan 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants