danielhrisca / asammdf

Fast Python reader and editor for ASAM MDF / MF4 (Measurement Data Format) files
GNU Lesser General Public License v3.0
609 stars 216 forks source link

Installation failing on MacBook M2 Pro with Sonoma 14.4.1 #1038

Open joshiji opened 1 week ago

joshiji commented 1 week ago

Python version

('python=3.9.6 (default, Aug 11 2023, 19:44:49) \n'
 '[Clang 15.0.0 (clang-1500.0.40.1)]')
'os=macOS-14.4.1-arm64-arm-64bit'

Description

When I am running pip install asammdf, it is failing to compile cutils.o. Following is the log output starting at failing part. Please let me know if full output will help in resolving this:

...
      creating build/temp.macosx-10.9-universal2-cpython-39
      creating build/temp.macosx-10.9-universal2-cpython-39/src
      creating build/temp.macosx-10.9-universal2-cpython-39/src/asammdf
      creating build/temp.macosx-10.9-universal2-cpython-39/src/asammdf/blocks
      clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -iwithsysroot/System/Library/Frameworks/System.framework/PrivateHeaders -iwithsysroot/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -arch arm64 -arch x86_64 -Werror=implicit-function-declaration -Wno-error=unreachable-code -I/private/var/folders/bz/hsz3cjcd1cx0fvs8cgcfqzwh0000gn/T/pip-build-env-htz4l547/overlay/lib/python3.9/site-packages/numpy/_core/include -I/Users/santosh/dev/area51/ridot_telemetry/venv/include -I/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/Headers -c src/asammdf/blocks/cutils.c -o build/temp.macosx-10.9-universal2-cpython-39/src/asammdf/blocks/cutils.o -std=c99
      src/asammdf/blocks/cutils.c:253:20: error: no member named 'elsize' in 'struct _PyArray_Descr'
                  descr->elsize = max;
                  ~~~~~  ^
      src/asammdf/blocks/cutils.c:361:24: warning: unused variable 'current_size' [-Wunused-variable]
          unsigned long long current_size = 0, * offsets_array;
                             ^
      src/asammdf/blocks/cutils.c:1241:28: warning: comparison of integers of different signs: 'int' and 'unsigned long long' [-Wsign-compare]
                  for (int i=0; i<cycles; i++) {
                                ~^~~~~~~
      src/asammdf/blocks/cutils.c:1272:16: warning: incompatible pointer types assigning to 'PyArrayObject *' (aka 'struct tagPyArrayObject *') from 'PyObject *' (aka 'struct _object *') [-Wincompatible-pointer-types]
              result = PyArray_ZEROS(1, dims, NPY_BOOL, 0);
                     ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      3 warnings and 1 error generated.
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for asammdf
Failed to build asammdf
ERROR: Could not build wheels for asammdf, which is required to install pyproject.toml-based projects
joshiji commented 1 week ago

For now, I was able to install using --prefer-binary option for pip install.

KingJuleZ commented 1 week ago

Thanks that worked well to install it. However then I run into a numpy problem...

    from .cutils import get_channel_raw_bytes
ImportError: numpy.core.multiarray failed to import
danielhrisca commented 1 week ago

For now you should not use asammdf in combination with numpy 2.0.0

KingJuleZ commented 1 week ago

Hi Daniel, could you add more details on that? My pip doesn't find no version 2.0.0 of jumpy. However, @joshiji 's solution works for now...

danielhrisca commented 1 week ago

It was a typo. Numpy

KingJuleZ commented 1 week ago

Alright got that, thanks for the great work!

joshiji commented 1 week ago

@KingJuleZ I realised that --prefer-binary installed v6 of asammdf, which is like four years old. There don't seem to be binary wheels available for Apple Silicon Macs for new version.

KingJuleZ commented 1 week ago

Oh okay, however for my code it does the job