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

linux/arm64 wheel errors out with type error: ValueError: Buffer dtype mismatch, expected 'const char' but got 'signed char' #566

Open
snazzer opened this issue Mar 28, 2023 · 0 comments

Comments

@snazzer
Copy link

snazzer commented Mar 28, 2023

Building the library for use on arm64 on linux through docker raises a type error.

To reproduce, build the given Dockerfile in both amd64 and arm64 platforms

FROM python:3.9-slim-buster

RUN apt update -y
RUN apt install gcc g++ git -y

RUN git clone --branch v0.15.2 https://github.com/data61/anonlink.git

WORKDIR anonlink

RUN pip install -r requirements.txt && \
   pip install -e .

e.g. (I did this on an M1 mac)

$ docker build --platform=linux/amd64 -t anonlink-testcase:amd64 .
$ docker build --platform=linux/arm64 -t anonlink-testcase:arm64 .

Then running amd64 test

$ docker run --rm anonlink-testcase:amd64 pytest tests/test_popcount.py::test_popcnt_array
# passes

But with arm64

$ docker run --rm anonlink-testcase:arm64 pytest tests/test_popcount.py::test_popcnt_array
.....
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_popcount.py:29: in test_popcnt_array
    output_counts = _dice.popcount_arrays(carr, array_size)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

>   cpdef unsigned int[::1] popcount_arrays(const char[::1] input_data, unsigned int array_bytes = 128):
E   ValueError: Buffer dtype mismatch, expected 'const char' but got 'signed char'

anonlink/similarities/_dice.pyx:13: ValueError
---------------------------------- Hypothesis ----------------------------------
Falsifying example: test_popcnt_array(
    data=data(...), num_bytes=2048,
)
....

Would appreciate some guidance for a fix.

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

1 participant