simpeg / discretize

Discretization tools for finite volume and inverse problems.
http://discretize.simpeg.xyz/
MIT License
167 stars 34 forks source link

#BUG: failing developer install #383

Closed lheagy closed 2 weeks ago

lheagy commented 2 weeks ago

I followed our instructions in the docs for the editable install of discretize in a brand-new environment (python 3.11) and am running into an error about "numpy/arrayobject.h" not being found after running

conda install -c conda-forge meson-python meson ninja cython setuptools_scm
pip install --no-build-isolation --editable .

The error is

[1/8] Compiling C object discretize/_extensions/interputils_cython.cpython-311-darwin.so.p/meson-generated_discretize__extensions_interputils_cython.pyx.c.o
      FAILED: discretize/_extensions/interputils_cython.cpython-311-darwin.so.p/meson-generated_discretize__extensions_interputils_cython.pyx.c.o
      cc -Idiscretize/_extensions/interputils_cython.cpython-311-darwin.so.p -Idiscretize/_extensions -I../../discretize/_extensions -I/Users/lindseyjh/miniforge3/envs/test-env/include/python3.11 -I/private/var/folders/sl/j1q3fxbx71q7r5kh4vv1r1rm0000gn/T/pip-build-env-124jdt8f/overlay/lib/python3.11/site-packages/numpy/_core/include -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -Wall -Winvalid-pch -O3 -Wno-unused-but-set-variable -Wno-unused-function -Wno-conversion -Wno-misleading-indentation -DNPY_NO_DEPRECATED_API=NPY_1_22_API_VERSION -MD -MQ discretize/_extensions/interputils_cython.cpython-311-darwin.so.p/meson-generated_discretize__extensions_interputils_cython.pyx.c.o -MF discretize/_extensions/interputils_cython.cpython-311-darwin.so.p/meson-generated_discretize__extensions_interputils_cython.pyx.c.o.d -o discretize/_extensions/interputils_cython.cpython-311-darwin.so.p/meson-generated_discretize__extensions_interputils_cython.pyx.c.o -c discretize/_extensions/interputils_cython.cpython-311-darwin.so.p/discretize/_extensions/interputils_cython.pyx.c
      discretize/_extensions/interputils_cython.cpython-311-darwin.so.p/discretize/_extensions/interputils_cython.pyx.c:1227:10: fatal error: 'numpy/arrayobject.h' file not found
      #include "numpy/arrayobject.h"
               ^~~~~~~~~~~~~~~~~~~~~

Note that it also fails inside of other places including the simplex_helpers, tree_ext , etc.

conda environment

# Name                    Version                   Build  Channel
bzip2                     1.0.8                h99b78c6_7    conda-forge
ca-certificates           2024.8.30            hf0a4a13_0    conda-forge
cython                    3.0.11          py311hf7f79b8_3    conda-forge
libcxx                    19.1.2               ha82da77_0    conda-forge
libexpat                  2.6.3                hf9b8971_0    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libsqlite                 3.47.0               hbaaea75_0    conda-forge
libzlib                   1.3.1                h8359307_2    conda-forge
meson                     1.6.0              pyhd8ed1ab_0    conda-forge
meson-python              0.17.1             pyh70fd9c4_0    conda-forge
ncurses                   6.5                  h7bae524_1    conda-forge
ninja                     1.12.1               h420ef59_0    conda-forge
openssl                   3.3.2                h8359307_0    conda-forge
packaging                 24.1               pyhd8ed1ab_0    conda-forge
pip                       24.2               pyh8b19718_1    conda-forge
pyproject-metadata        0.9.0              pyh2cfa8aa_0    conda-forge
python                    3.11.10         hc51fdd5_3_cpython    conda-forge
python_abi                3.11                    5_cp311    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
setuptools                75.1.0             pyhd8ed1ab_0    conda-forge
setuptools-scm            8.1.0              pyhd8ed1ab_0    conda-forge
setuptools_scm            8.1.0                hd8ed1ab_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
tomli                     2.0.2              pyhd8ed1ab_0    conda-forge
typing-extensions         4.12.2               hd8ed1ab_0    conda-forge
typing_extensions         4.12.2             pyha770c72_0    conda-forge
tzdata                    2024b                hc8b5060_0    conda-forge
wheel                     0.44.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge

Note that I also tried installing numpy and re-running the discretize install and it still failed.

Any suggestions are welcome!

jcapriot commented 2 weeks ago

An interesting, but yes you definitely need numpy installed in the build environment.

jcapriot commented 2 weeks ago

But it should’ve given you an error earlier about not finding numpy.

lheagy commented 2 weeks ago

Yeah, I tried re-running after installing numpy and still run into the same error. Here is the updated env

# Name                    Version                   Build  Channel
bzip2                     1.0.8                h99b78c6_7    conda-forge
ca-certificates           2024.8.30            hf0a4a13_0    conda-forge
cython                    3.0.11          py311hf7f79b8_3    conda-forge
libblas                   3.9.0           25_osxarm64_openblas    conda-forge
libcblas                  3.9.0           25_osxarm64_openblas    conda-forge
libcxx                    19.1.2               ha82da77_0    conda-forge
libexpat                  2.6.3                hf9b8971_0    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgfortran               5.0.0           13_2_0_hd922786_3    conda-forge
libgfortran5              13.2.0               hf226fd6_3    conda-forge
liblapack                 3.9.0           25_osxarm64_openblas    conda-forge
libopenblas               0.3.28          openmp_h517c56d_0    conda-forge
libsqlite                 3.47.0               hbaaea75_0    conda-forge
libzlib                   1.3.1                h8359307_2    conda-forge
llvm-openmp               19.1.2               hb52a8e5_0    conda-forge
meson                     1.6.0              pyhd8ed1ab_0    conda-forge
meson-python              0.17.1             pyh70fd9c4_0    conda-forge
ncurses                   6.5                  h7bae524_1    conda-forge
ninja                     1.12.1               h420ef59_0    conda-forge
numpy                     2.1.2           py311h6de8079_0    conda-forge
openssl                   3.3.2                h8359307_0    conda-forge
packaging                 24.1               pyhd8ed1ab_0    conda-forge
pip                       24.2               pyh8b19718_1    conda-forge
pyproject-metadata        0.9.0              pyh2cfa8aa_0    conda-forge
python                    3.11.10         hc51fdd5_3_cpython    conda-forge
python_abi                3.11                    5_cp311    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
setuptools                75.1.0             pyhd8ed1ab_0    conda-forge
setuptools-scm            8.1.0              pyhd8ed1ab_0    conda-forge
setuptools_scm            8.1.0                hd8ed1ab_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
tomli                     2.0.2              pyhd8ed1ab_0    conda-forge
typing-extensions         4.12.2               hd8ed1ab_0    conda-forge
typing_extensions         4.12.2             pyha770c72_0    conda-forge
tzdata                    2024b                hc8b5060_0    conda-forge
wheel                     0.44.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge

Do you think it is an issue with numpy 2.0?

edit: I also tried rolling back numpy to 1.26.4 and it still fails

jcapriot commented 2 weeks ago

It should definitely fail building against numpy <2.0, as it requires the numpy_config tool that was added then. If you’re not starting from a clean repository, it’s possible that meson is re-using configurations from previous builds. Try removing the build directory and starting again.

Also, it could be clearer, but the editable install section does say you should install the runtime requirements as well, https://discretize.simpeg.xyz/en/latest/content/installing.html#editable-installs

jcapriot commented 2 weeks ago

If that doesn’t work, please paste the full output of the install command.

lheagy commented 2 weeks ago

Thanks for your help @jcapriot! I downgraded numpy, removed the build folder and gave it another try. Still no luck.

environment

#
# Name                    Version                   Build  Channel
bzip2                     1.0.8                h99b78c6_7    conda-forge
ca-certificates           2024.8.30            hf0a4a13_0    conda-forge
cython                    3.0.11          py311hf7f79b8_3    conda-forge
libblas                   3.9.0           25_osxarm64_openblas    conda-forge
libcblas                  3.9.0           25_osxarm64_openblas    conda-forge
libcxx                    19.1.2               ha82da77_0    conda-forge
libexpat                  2.6.3                hf9b8971_0    conda-forge
libffi                    3.4.2                h3422bc3_5    conda-forge
libgfortran               5.0.0           13_2_0_hd922786_3    conda-forge
libgfortran5              13.2.0               hf226fd6_3    conda-forge
liblapack                 3.9.0           25_osxarm64_openblas    conda-forge
libopenblas               0.3.28          openmp_h517c56d_0    conda-forge
libsqlite                 3.47.0               hbaaea75_0    conda-forge
libzlib                   1.3.1                h8359307_2    conda-forge
llvm-openmp               19.1.2               hb52a8e5_0    conda-forge
meson                     1.6.0              pyhd8ed1ab_0    conda-forge
meson-python              0.17.1             pyh70fd9c4_0    conda-forge
ncurses                   6.5                  h7bae524_1    conda-forge
ninja                     1.12.1               h420ef59_0    conda-forge
numpy                     1.26.4          py311h7125741_0    conda-forge
openssl                   3.3.2                h8359307_0    conda-forge
packaging                 24.1               pyhd8ed1ab_0    conda-forge
pip                       24.2               pyh8b19718_1    conda-forge
pyproject-metadata        0.9.0              pyh2cfa8aa_0    conda-forge
python                    3.11.10         hc51fdd5_3_cpython    conda-forge
python_abi                3.11                    5_cp311    conda-forge
readline                  8.2                  h92ec313_1    conda-forge
setuptools                75.1.0             pyhd8ed1ab_0    conda-forge
setuptools-scm            8.1.0              pyhd8ed1ab_0    conda-forge
setuptools_scm            8.1.0                hd8ed1ab_0    conda-forge
tk                        8.6.13               h5083fa2_1    conda-forge
tomli                     2.0.2              pyhd8ed1ab_0    conda-forge
typing-extensions         4.12.2               hd8ed1ab_0    conda-forge
typing_extensions         4.12.2             pyha770c72_0    conda-forge
tzdata                    2024b                hc8b5060_0    conda-forge
wheel                     0.44.0             pyhd8ed1ab_0    conda-forge
xz                        5.2.6                h57fd34a_0    conda-forge

Error

(test-env) ➜  discretize git:(main) ✗ pip install --no-build-isolation --editable .
Obtaining file:///Users/lindseyjh/git/simpeg/discretize
  Checking if build backend supports build_editable ... done
  Preparing editable metadata (pyproject.toml) ... error
  error: subprocess-exited-with-error

  × Preparing editable metadata (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]
      + meson setup /Users/lindseyjh/git/simpeg/discretize /Users/lindseyjh/git/simpeg/discretize/build/cp311 -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-python-native-file.ini
      The Meson build system
      Version: 1.6.0
      Source dir: /Users/lindseyjh/git/simpeg/discretize
      Build dir: /Users/lindseyjh/git/simpeg/discretize/build/cp311
      Build type: native build
      Project name: discretize
      Project version: 0.11.1.dev2+gcf1b6b58
      C compiler for the host machine: cc (clang 14.0.3 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
      C linker for the host machine: cc ld64 857.1
      C++ compiler for the host machine: c++ (clang 14.0.3 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
      C++ linker for the host machine: c++ ld64 857.1
      Cython compiler for the host machine: cython (cython 3.0.11)
      Host machine cpu family: aarch64
      Host machine cpu: aarch64
      Program python found: YES (/Users/lindseyjh/miniforge3/envs/test-env/bin/python3.11)
      Did not find pkg-config by name 'pkg-config'
      Found pkg-config: NO
      Run-time dependency python found: YES 3.11
      Program cython found: YES (/Users/lindseyjh/miniforge3/envs/test-env/bin/cython)
      Compiler for C supports arguments -Wno-unused-but-set-variable: YES
      Compiler for C supports arguments -Wno-unused-function: YES
      Compiler for C supports arguments -Wno-conversion: YES
      Compiler for C supports arguments -Wno-misleading-indentation: YES
      Library m found: YES
      numpy-config found: NO
      Run-time dependency numpy found: NO (tried config-tool)

      ../../discretize/_extensions/meson.build:3:9: ERROR: Dependency lookup for numpy with method 'pkgconfig' failed: Pkg-config for machine host machine not found. Giving up.

      A full log can be found at /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-logs/meson-log.txt
      [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.

contents of meson-log

Build started at 2024-10-27T15:50:42.035084
Main binary: /Users/lindseyjh/miniforge3/envs/test-env/bin/python3.11
Build Options: -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-python-native-file.ini
Python system: Darwin
The Meson build system
Version: 1.6.0
Source dir: /Users/lindseyjh/git/simpeg/discretize
Build dir: /Users/lindseyjh/git/simpeg/discretize/build/cp311
Build type: native build
Running command: /Users/lindseyjh/miniforge3/envs/test-env/bin/python -c '
from setuptools_scm import get_version
print(get_version())'
--- stdout ---
0.11.1.dev2+gcf1b6b58

--- stderr ---

Project name: discretize
Project version: 0.11.1.dev2+gcf1b6b58
-----------
Detecting compiler via: `cc --version` -> 0
stdout:
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
-----------
Running command: -x c -E -dM -
-----
-----------
Detecting linker via: `cc -Wl,--version` -> 1
stderr:
ld: unknown option: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
-----------
Detecting Apple linker via: `cc -Wl,-v` -> 1
stderr:
@(#)PROGRAM:ld  PROJECT:ld64-857.1
BUILD 23:13:29 May  7 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
    /usr/local/lib
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
Framework search paths:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
Undefined symbols for architecture arm64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
Sanity testing C compiler: cc
Is cross compiler: False.
Sanity check compiler command line: cc sanitycheckc.c -o sanitycheckc.exe
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
Running test binary command:  /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/sanitycheckc.exe
C compiler for the host machine: cc (clang 14.0.3 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
C linker for the host machine: cc ld64 857.1
-----------
Detecting archiver via: `llvm-ar-14 --version` -> [Errno 2] No such file or directory: 'llvm-ar-14'
-----------
Detecting archiver via: `llvm-ar --version` -> [Errno 2] No such file or directory: 'llvm-ar'
-----------
Detecting archiver via: `ar --version` -> 1
stderr:
usage:  ar -d [-TLsv] archive file ...
    ar -m [-TLsv] archive file ...
    ar -m [-abiTLsv] position archive file ...
    ar -p [-TLsv] archive [file ...]
    ar -q [-cTLsv] archive file ...
    ar -r [-cuTLsv] archive file ...
    ar -r [-abciuTLsv] position archive file ...
    ar -t [-TLsv] archive [file ...]
    ar -x [-ouTLsv] archive [file ...]
-----------
-----------
Detecting compiler via: `c++ --version` -> 0
stdout:
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
-----------
Running command: -x c++ -E -dM -
-----
-----------
Detecting linker via: `c++ -Wl,--version` -> 1
stderr:
ld: unknown option: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
-----------
Detecting Apple linker via: `c++ -Wl,-v` -> 1
stderr:
@(#)PROGRAM:ld  PROJECT:ld64-857.1
BUILD 23:13:29 May  7 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
    /usr/local/lib
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
Framework search paths:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
Undefined symbols for architecture arm64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
Sanity testing C++ compiler: c++
Is cross compiler: False.
Sanity check compiler command line: c++ sanitycheckcpp.cc -o sanitycheckcpp.exe
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
Running test binary command:  /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/sanitycheckcpp.exe
C++ compiler for the host machine: c++ (clang 14.0.3 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
C++ linker for the host machine: c++ ld64 857.1
-----------
Detecting compiler via: `cython -V` -> 0
stdout:
Cython version 3.0.11
-----------
stderr:
Cython version 3.0.11
-----------
Running compile:
Working directory:  /var/folders/sl/j1q3fxbx71q7r5kh4vv1r1rm0000gn/T/tmpv_kb_alk
Code:
print("hello world")
-----------
Command line: `cython /var/folders/sl/j1q3fxbx71q7r5kh4vv1r1rm0000gn/T/tmpv_kb_alk/testfile.pyx -o /var/folders/sl/j1q3fxbx71q7r5kh4vv1r1rm0000gn/T/tmpv_kb_alk/output.exe --fast-fail` -> 0
stderr:
/Users/lindseyjh/miniforge3/envs/test-env/lib/python3.11/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /var/folders/sl/j1q3fxbx71q7r5kh4vv1r1rm0000gn/T/tmpv_kb_alk/testfile.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)
-----------
Cython compiler for the host machine: cython (cython 3.0.11)
-----------
Detecting compiler via: `cc --version` -> 0
stdout:
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
-----------
Running command: -x c -E -dM -
-----
-----------
Detecting linker via: `cc -Wl,--version` -> 1
stderr:
ld: unknown option: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
-----------
Detecting Apple linker via: `cc -Wl,-v` -> 1
stderr:
@(#)PROGRAM:ld  PROJECT:ld64-857.1
BUILD 23:13:29 May  7 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
    /usr/local/lib
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
Framework search paths:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
Undefined symbols for architecture arm64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
Sanity testing C compiler: cc
Is cross compiler: False.
Sanity check compiler command line: cc sanitycheckc.c -o sanitycheckc.exe
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
Running test binary command:  /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/sanitycheckc.exe
C compiler for the build machine: cc (clang 14.0.3 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
C linker for the build machine: cc ld64 857.1
-----------
Detecting archiver via: `llvm-ar-14 --version` -> [Errno 2] No such file or directory: 'llvm-ar-14'
-----------
Detecting archiver via: `llvm-ar --version` -> [Errno 2] No such file or directory: 'llvm-ar'
-----------
Detecting archiver via: `ar --version` -> 1
stderr:
usage:  ar -d [-TLsv] archive file ...
    ar -m [-TLsv] archive file ...
    ar -m [-abiTLsv] position archive file ...
    ar -p [-TLsv] archive [file ...]
    ar -q [-cTLsv] archive file ...
    ar -r [-cuTLsv] archive file ...
    ar -r [-abciuTLsv] position archive file ...
    ar -t [-TLsv] archive [file ...]
    ar -x [-ouTLsv] archive [file ...]
-----------
-----------
Detecting compiler via: `c++ --version` -> 0
stdout:
Apple clang version 14.0.3 (clang-1403.0.22.14.1)
Target: arm64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
-----------
Running command: -x c++ -E -dM -
-----
-----------
Detecting linker via: `c++ -Wl,--version` -> 1
stderr:
ld: unknown option: --version
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
-----------
Detecting Apple linker via: `c++ -Wl,-v` -> 1
stderr:
@(#)PROGRAM:ld  PROJECT:ld64-857.1
BUILD 23:13:29 May  7 2023
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
    /usr/local/lib
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib
Framework search paths:
    /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/
Undefined symbols for architecture arm64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
-----------
Sanity testing C++ compiler: c++
Is cross compiler: False.
Sanity check compiler command line: c++ sanitycheckcpp.cc -o sanitycheckcpp.exe
Sanity check compile stdout:

-----
Sanity check compile stderr:

-----
Running test binary command:  /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/sanitycheckcpp.exe
C++ compiler for the build machine: c++ (clang 14.0.3 "Apple clang version 14.0.3 (clang-1403.0.22.14.1)")
C++ linker for the build machine: c++ ld64 857.1
-----------
Detecting compiler via: `cython -V` -> 0
stdout:
Cython version 3.0.11
-----------
stderr:
Cython version 3.0.11
-----------
Using cached compile:
Cached command line:  cython /var/folders/sl/j1q3fxbx71q7r5kh4vv1r1rm0000gn/T/tmpv_kb_alk/testfile.pyx -o /var/folders/sl/j1q3fxbx71q7r5kh4vv1r1rm0000gn/T/tmpv_kb_alk/output.exe --fast-fail 

Code:
 print("hello world")
Cached compiler stdout:

Cached compiler stderr:
 /Users/lindseyjh/miniforge3/envs/test-env/lib/python3.11/site-packages/Cython/Compiler/Main.py:381: FutureWarning: Cython directive 'language_level' not set, using '3str' for now (Py3). This has changed from earlier releases! File: /var/folders/sl/j1q3fxbx71q7r5kh4vv1r1rm0000gn/T/tmpv_kb_alk/testfile.pyx
  tree = Parsing.p_module(s, pxd, full_module_name)

Cython compiler for the build machine: cython (cython 3.0.11)
Build machine cpu family: aarch64
Build machine cpu: aarch64
Host machine cpu family: aarch64
Host machine cpu: aarch64
Target machine cpu family: aarch64
Target machine cpu: aarch64
Program python found: YES (/Users/lindseyjh/miniforge3/envs/test-env/bin/python3.11)
Searching for 'python-3.11' via pkgconfig lookup in LIBPC
Pkg-config binary missing from cross or native file, or env var undefined.
Trying a default Pkg-config fallback at pkg-config
Did not find pkg-config by name 'pkg-config'
Found pkg-config: NO
Pkg-config for machine host machine not found. Giving up.
"python-3.11" could not be found in LIBPC, this is likely due to a relocated python installation
Searching for 'python-3.11' via fallback pkgconfig lookup in default paths
Pkg-config for machine host machine not found. Giving up.
Running compile:
Working directory:  /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmpupu_f4xk
Code:

        #ifdef __has_include
         #if !__has_include("Python.h")
          #error "Header 'Python.h' could not be found"
         #endif
        #else
         #include <Python.h>
        #endif
-----------
Command line: `c++ -I/Users/lindseyjh/miniforge3/envs/test-env/include/python3.11 /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmpupu_f4xk/testfile.cpp -E -P -P -O0 -fpermissive -Werror=implicit-function-declaration` -> 0
Run-time dependency python found: YES 3.11
Program cython found: YES (/Users/lindseyjh/miniforge3/envs/test-env/bin/cython)
Running compile:
Working directory:  /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmp_3600k_v
Code:
extern int i;
int i;

-----------
Command line: `cc /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmp_3600k_v/testfile.c -o /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmp_3600k_v/output.obj -c -O0 -Werror=implicit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument -Wunused-but-set-variable -Wno-unused-but-set-variable` -> 0
Compiler for C supports arguments -Wno-unused-but-set-variable: YES 
Running compile:
Working directory:  /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmprblidrmr
Code:
extern int i;
int i;

-----------
Command line: `cc /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmprblidrmr/testfile.c -o /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmprblidrmr/output.obj -c -O0 -Werror=implicit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument -Wunused-function -Wno-unused-function` -> 0
Compiler for C supports arguments -Wno-unused-function: YES 
Running compile:
Working directory:  /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmpuwd5vmqi
Code:
extern int i;
int i;

-----------
Command line: `cc /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmpuwd5vmqi/testfile.c -o /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmpuwd5vmqi/output.obj -c -O0 -Werror=implicit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument -Wconversion -Wno-conversion` -> 0
Compiler for C supports arguments -Wno-conversion: YES 
Running compile:
Working directory:  /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmp_yagpp5i
Code:
extern int i;
int i;

-----------
Command line: `cc /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmp_yagpp5i/testfile.c -o /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmp_yagpp5i/output.obj -c -O0 -Werror=implicit-function-declaration -Werror=unknown-warning-option -Werror=unused-command-line-argument -Werror=ignored-optimization-argument -Wmisleading-indentation -Wno-misleading-indentation` -> 0
Compiler for C supports arguments -Wno-misleading-indentation: YES 
Running compile:
Working directory:  /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmp09j7dgbk
Code:
int main(void) { return 0; }

-----------
Command line: `cc /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmp09j7dgbk/testfile.c -o /Users/lindseyjh/git/simpeg/discretize/build/cp311/meson-private/tmp09j7dgbk/output.exe -O0 -Werror=implicit-function-declaration -lm -Wl,-undefined,dynamic_lookup` -> 0
Library m found: YES
Dependency lookup for numpy with method 'pkgconfig' failed: Pkg-config for machine host machine not found. Giving up.
numpy-config binary missing from cross or native file, or env var undefined.
Trying a default numpy-config fallback at numpy-config
numpy-config found: NO
Run-time dependency numpy found: NO (tried config-tool)

../../discretize/_extensions/meson.build:3:9: ERROR: Dependency lookup for numpy with method 'pkgconfig' failed: Pkg-config for machine host machine not found. Giving up.
jcapriot commented 2 weeks ago

Ok good, it fails as expected there when numpy<2.0. As I said, it now requires numpy>=2.0 to build.

leonfoks commented 2 weeks ago

im seeing a lot failed pkg-configs.

Try “brew install pkg-config”

i had some recent issues with auto numpy detection on a Mac and this fixed it for me.

lheagy commented 2 weeks ago

Many thanks @leonfoks and @jcapriot! Numpy>2.0 and brew installing pkg-config did the trick. Much appreciated!

jcapriot commented 2 weeks ago

Discretize doesn’t explicitly need pkg-config unless you’re doing some crazy cross-compilation. Recent versions of meson (>=1.4) can use numpy 2.0’s numpy_config script to find the necessary information.

lheagy commented 2 weeks ago

Interesting. Just updating numpy on its own still failed. So something on my machine needed pkg-config...

jcapriot commented 2 weeks ago

I wonder if just upgrading numpy wasn’t enough to trigger meson to reconfigure the build directory? But once you had pkg-config it decided to try to reconfigure, but I wouldn’t know for sure unless you still had the build outputs.

leonfoks commented 2 weeks ago

Fwiw i never had this problem on older mac OS versions. After a recent update, a few different issues have cropped up.

lheagy commented 2 weeks ago

Ah, I cleared all of the builds, so unfortunately can't give you any further insights, but at least we know that if other folks on a mac run into this issue, trying to update pkg-config might do the trick

jcapriot commented 2 weeks ago

Oh well

just to be clear on how meson’s dependancy(“numpy”) function works, in order it will: