danielhrisca / asammdf

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

Installation failing on MacBook M2 Pro with Sonoma 14.4.1 #1038

Open joshiji opened 5 months ago

joshiji commented 5 months 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 5 months ago

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

KingJuleZ commented 5 months 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 5 months ago

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

KingJuleZ commented 5 months 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 5 months ago

It was a typo. Numpy

KingJuleZ commented 5 months ago

Alright got that, thanks for the great work!

joshiji commented 5 months 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 5 months ago

Oh okay, however for my code it does the job

MehdiJaiemMHP commented 4 months ago

Any update regarding this? I am also facing the same problem with python 3.11.7

annotated-types 0.7.0 anyio 4.4.0 attrs 23.2.0 canmatrix 1.0 click 8.1.7 coverage 7.5.4 deltalake 0.18.2 fastapi 0.109.2 future 1.0.0 gunicorn 20.1.0 h11 0.14.0 idna 3.7 iniconfig 2.0.0 lxml 5.2.2 lz4 4.3.3 natsort 8.4.0 numexpr 2.10.1 numpy 2.0.0 packaging 24.1 pandas 2.2.0 pip 23.2.1 pluggy 1.5.0 pyarrow 15.0.0 pyarrow-hotfix 0.6 pydantic 2.6.1 pydantic_core 2.16.2 pytest 8.0.0 pytest-cov 4.1.0 pytest-snapshot 0.9.0 python-dateutil 2.9.0.post0 pytz 2024.1 setuptools 65.5.0 six 1.16.0 sniffio 1.3.1 starlette 0.36.3 typing_extensions 4.12.2 tzdata 2024.1 uvicorn 0.27.0.post1 wheel 0.43.0

MatheusAndrade97 commented 4 months ago

Any update regarding this? I am also facing the same problem with python 3.11.7

annotated-types 0.7.0 anyio 4.4.0 attrs 23.2.0 canmatrix 1.0 click 8.1.7 coverage 7.5.4 deltalake 0.18.2 fastapi 0.109.2 future 1.0.0 gunicorn 20.1.0 h11 0.14.0 idna 3.7 iniconfig 2.0.0 lxml 5.2.2 lz4 4.3.3 natsort 8.4.0 numexpr 2.10.1 numpy 2.0.0 packaging 24.1 pandas 2.2.0 pip 23.2.1 pluggy 1.5.0 pyarrow 15.0.0 pyarrow-hotfix 0.6 pydantic 2.6.1 pydantic_core 2.16.2 pytest 8.0.0 pytest-cov 4.1.0 pytest-snapshot 0.9.0 python-dateutil 2.9.0.post0 pytz 2024.1 setuptools 65.5.0 six 1.16.0 sniffio 1.3.1 starlette 0.36.3 typing_extensions 4.12.2 tzdata 2024.1 uvicorn 0.27.0.post1 wheel 0.43.0

I'm using asammdf==7.4.5 and it is ok for me. Did you try this version?

MehdiJaiemMHP commented 4 months ago

@MatheusAndrade97 Yes I also installed that version, and it worked, but we would have liked to stay synchronized and use one common virtual environment for the team since they are using an earlier version