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

ValueError which says Buffer dtype mismatch, expected 'Py_ssize_t' but got 'long' #36

Open
karongsama opened this issue Apr 9, 2023 · 3 comments

Comments

@karongsama
Copy link

Hi,malcolmw.
When I use ur pykonal package,I always get the ERROR that says 'could not get source code'.And I also get the ValueERROR which says 'Buffer dtype mismatch, expected 'Py_ssize_t' but got 'long' '.
I dont understand why I just copy your code and try to run but failed.
I've try to download the past version but still failed
I wonder if my computer went wrong or something get wrong.
Please help me
Thanks

@malcolmw
Copy link
Owner

Hi @karongsama, Can you please tell me about your environment such as you OS and versions of Python and cython?

@karongsama
Copy link
Author

karongsama commented Apr 10, 2023

i use windows and 3.10.9python,0.29.33Cython
i think thats my environment problem because when i use online server it can run as i expected
maybe its better to use 3.8 python or there is some packages conflict with pykonal
or just Cython has something wrong because the type Py_ssize_t
Thanks for ur help!

@malcolmw
Copy link
Owner

Hi @karongsama, unfortunately I have encountered this problem before on Windows and was unable to debug it in platform-independent way, so I am unable to support Windows users at this time. Do you have access to a Linux machine you can work on?

Cleaf-y added a commit to Cleaf-y/pykonal that referenced this issue Mar 10, 2024
…dtype

Addressing Issue malcolmw#36 The expected type was 'Py_ssize_t', but 'long' was provided instead. This led to runtime exception. The solution was to explicitly set the dtype parameter to np.intp in the np.full function call. 

This modification resolves the error on Windows by ensuring the type matches the expected 'Py_ssize_t', as np.intp is the numpy data type that maps to 'ssize_t' on the platform being compiled on, thus aligning with Python's indexing types and C's ssize_t on Windows.
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