Thanks to visit codestin.com
Credit goes to github.com

Skip to content

stringdtype fails to build on Linux #90

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

Closed
lysnikolaou opened this issue Oct 4, 2023 · 2 comments
Closed

stringdtype fails to build on Linux #90

lysnikolaou opened this issue Oct 4, 2023 · 2 comments

Comments

@lysnikolaou
Copy link
Member

lysnikolaou commented Oct 4, 2023

Hey! While trying to test stringdtype with numpy/numpy#24835, I encountered some build failures, which also occur when trying to build with the latest numpy nightly. Am I doing something wrong?

Here's the failure I get
numpy-user-dtypes/stringdtype on main is 📦 v0.0.1 via 🐍 v3.11.5 (venv) 
❯ python -m build --wheel -Cbuilddir=build
* Creating venv isolated environment...
* Installing packages in isolated environment... (meson-python, meson>=0.63.0, numpy, patchelf, wheel)
* Getting build dependencies for wheel...
* Installing packages in isolated environment... (ninja >= 1.8.2)
* Building wheel...
+ meson setup --reconfigure /home/lysnikolaou/repos/numpy-user-dtypes/stringdtype /home/lysnikolaou/repos/numpy-user-dtypes/stringdtype/build -Dbuildtype=release -Db_ndebug=if-release -Db_vscrt=md --native-file=/home/lysnikolaou/repos/numpy-user-dtypes/stringdtype/build/meson-python-native-file.ini
The Meson build system
Version: 1.2.2
Source dir: /home/lysnikolaou/repos/numpy-user-dtypes/stringdtype
Build dir: /home/lysnikolaou/repos/numpy-user-dtypes/stringdtype/build
Build type: native build
Project name: stringdtype
Project version: undefined
C compiler for the host machine: ccache cc (gcc 11.4.0 "cc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0")
C linker for the host machine: cc ld.bfd 2.38
Host machine cpu family: x86_64
Host machine cpu: x86_64
/tmp/build-env-mokwxajm/lib/python3.11/site-packages/mesonbuild/dependencies/python.py:114: DeprecationWarning: path is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
  with importlib.resources.path('mesonbuild.scripts', 'python_info.py') as f:
Program python found: YES (/tmp/build-env-mokwxajm/bin/python)
Library npymath found: YES
Found pkg-config: /usr/bin/pkg-config (0.29.2)
Run-time dependency python found: YES 3.11
Build targets in project: 1

stringdtype undefined

  User defined options
    Native files: /home/lysnikolaou/repos/numpy-user-dtypes/stringdtype/build/meson-python-native-file.ini
    buildtype   : release
    b_ndebug    : if-release
    b_vscrt     : md

/tmp/build-env-mokwxajm/lib/python3.11/site-packages/mesonbuild/modules/python.py:332: DeprecationWarning: read_binary is deprecated. Use files() instead. Refer to https://importlib-resources.readthedocs.io/en/latest/using.html#migrating-from-legacy for migration advice.
  f.write(importlib.resources.read_binary('mesonbuild.scripts', 'pycompile.py'))
Found ninja-1.11.1.git.kitware.jobserver-1 at /tmp/build-env-mokwxajm/bin/ninja
Cleaning... 0 files.
+ /tmp/build-env-mokwxajm/bin/ninja
[2/6] Compiling C object _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_umath.c.o
FAILED: _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_umath.c.o 
ccache cc -I_main.cpython-311d-x86_64-linux-gnu.so.p -I. -I.. -I/tmp/build-env-mokwxajm/lib/python3.11/site-packages/numpy/core/include -I../stringdtype/src -I/home/lysnikolaou/repos/cpython-3.11.5/build/include/python3.11d -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -fPIC -MD -MQ _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_umath.c.o -MF _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_umath.c.o.d -o _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_umath.c.o -c ../stringdtype/src/umath.c
../stringdtype/src/umath.c: In function ‘init_ufuncs’:
../stringdtype/src/umath.c:969:49: error: ‘PyArray_Int8DType’ undeclared (first use in this function); did you mean ‘PyArray_Int8Type’?
  969 |             (PyArray_DTypeMeta *)&StringDType, &PyArray_##typename##DType, \
      |                                                 ^~~~
../stringdtype/src/umath.c:1112:5: note: in expansion of macro ‘INIT_MULTIPLY’
 1112 |     INIT_MULTIPLY(Int8, int8);
      |     ^~~~~
../stringdtype/src/umath.c:969:49: note: each undeclared identifier is reported only once for each function it appears in
  969 |             (PyArray_DTypeMeta *)&StringDType, &PyArray_##typename##DType, \
      |                                                 ^~~~
../stringdtype/src/umath.c:1112:5: note: in expansion of macro ‘INIT_MULTIPLY’
 1112 |     INIT_MULTIPLY(Int8, int8);
      |     ^~~~~
[4/6] Compiling C object _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_casts.c.o
FAILED: _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_casts.c.o 
ccache cc -I_main.cpython-311d-x86_64-linux-gnu.so.p -I. -I.. -I/tmp/build-env-mokwxajm/lib/python3.11/site-packages/numpy/core/include -I../stringdtype/src -I/home/lysnikolaou/repos/cpython-3.11.5/build/include/python3.11d -fvisibility=hidden -fdiagnostics-color=always -DNDEBUG -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -O3 -fPIC -MD -MQ _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_casts.c.o -MF _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_casts.c.o.d -o _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_casts.c.o -c ../stringdtype/src/casts.c
../stringdtype/src/casts.c: In function ‘string_to_float32’:
../stringdtype/src/casts.c:862:21: warning: implicit declaration of function ‘PyUFunc_GiveFloatingpointErrors’ [-Wimplicit-function-declaration]
  862 |                 if (PyUFunc_GiveFloatingpointErrors("cast",                  \
      |                     ^~~~~~~~~~~
../stringdtype/src/casts.c:984:1: note: in expansion of macro ‘STRING_TO_FLOAT_CAST’
  984 | STRING_TO_FLOAT_CAST(float32, f32, npy_isinf, npy_float32)
      | ^~~~~~~~
../stringdtype/src/casts.c: In function ‘string_to_datetime’:
../stringdtype/src/casts.c:1052:13: warning: implicit declaration of function ‘NpyDatetime_ParseISO8601Datetime’ [-Wimplicit-function-declaration]
 1052 |         if (NpyDatetime_ParseISO8601Datetime(
      |             ^~~~~~~~~~~~
../stringdtype/src/casts.c:1057:13: warning: implicit declaration of function ‘NpyDatetime_ConvertDatetimeStructToDatetime64’ [-Wimplicit-function-declaration]
 1057 |         if (NpyDatetime_ConvertDatetimeStructToDatetime64(dt_meta, &dts, out) <
      |             ^~~~~~~~~~~~~~~~~
../stringdtype/src/casts.c: In function ‘datetime_to_string’:
../stringdtype/src/casts.c:1106:17: warning: implicit declaration of function ‘NpyDatetime_ConvertDatetime64ToDatetimeStruct’ [-Wimplicit-function-declaration]
 1106 |             if (NpyDatetime_ConvertDatetime64ToDatetimeStruct(dt_meta, *in,
      |                 ^~~~~~~~~~~~~~~~~
../stringdtype/src/casts.c:1114:17: warning: implicit declaration of function ‘NpyDatetime_MakeISO8601Datetime’ [-Wimplicit-function-declaration]
 1114 |             if (NpyDatetime_MakeISO8601Datetime(
      |                 ^~~~~~~~~~~
../stringdtype/src/casts.c: In function ‘get_casts’:
../stringdtype/src/casts.c:756:49: error: ‘PyArray_Int8DType’ undeclared (first use in this function); did you mean ‘PyArray_Int8Type’?
  756 |             (PyArray_DTypeMeta *)&StringDType, &PyArray_##typename##DType);  \
      |                                                 ^~~~
../stringdtype/src/casts.c:1237:5: note: in expansion of macro ‘DTYPES_AND_CAST_SPEC’
 1237 |     DTYPES_AND_CAST_SPEC(i8, Int8)
      |     ^~~~~~~~
../stringdtype/src/casts.c:756:49: note: each undeclared identifier is reported only once for each function it appears in
  756 |             (PyArray_DTypeMeta *)&StringDType, &PyArray_##typename##DType);  \
      |                                                 ^~~~
../stringdtype/src/casts.c:1237:5: note: in expansion of macro ‘DTYPES_AND_CAST_SPEC’
 1237 |     DTYPES_AND_CAST_SPEC(i8, Int8)
      |     ^~~~~~~~
../stringdtype/src/casts.c:756:49: error: ‘PyArray_HalfDType’ undeclared (first use in this function); did you mean ‘PyArray_HalfType’?
  756 |             (PyArray_DTypeMeta *)&StringDType, &PyArray_##typename##DType);  \
      |                                                 ^~~~
../stringdtype/src/casts.c:1264:5: note: in expansion of macro ‘DTYPES_AND_CAST_SPEC’
 1264 |     DTYPES_AND_CAST_SPEC(f16, Half)
      |     ^~~~~~~~
[5/6] Compiling C object _main.cpython-311d-x86_64-linux-gnu.so.p/stringdtype_src_dtype.c.o
ninja: build stopped: subcommand failed.

ERROR Backend subprocess exited when trying to invoke build_wheel
@ngoldbaum
Copy link
Member

Thanks for the report!

I think this is an issue with the pyproject.toml. We need numpy 2.0dev but it's trying to build against numpy 1.26, which is missing a few items in the C API I added for 2.0. I'll update the instructions to suggest setting up the dev environment manually and using --no-build-isolation as I've been doing in development.

@ngoldbaum
Copy link
Member

I added new build instructions that should hopefully make it clearer that you need numpy dev and to build with --no-build-isolation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants