question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Buffer dtype mismatch, expected 'long' but got 'long long'

See original GitHub issue

hi, there is an error when I get nodal stress using NodalStress() method. I use the rst file in your closed issues “test_pyansys.rst”. I guess there is something wrong with numpy.int64 type.

the code is below:

stress = result.NodalStress(0)
Traceback (most recent call last):

  File "<ipython-input-12-6342d70f8bcd>", line 1, in <module>
    stress = result.NodalStress(0)

  File "C:\Users\zxmy\Anaconda3\lib\site-packages\pyansys\binary_reader.py", line 977, in NodalStress
    self.edge_idx.astype(np.int64))

  File "pyansys/cython/_rstHelper.pyx", line 158, in pyansys._rstHelper.LoadStress

ValueError: Buffer dtype mismatch, expected 'long' but got 'long long'

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

10reactions
akaszynskicommented, Feb 10, 2018

Ok. I’m closing this issue then. Thanks for testing it out. I’ll be a bit more diligent about keeping cython platform independent. To anyone out there who’s looking to make platform independent code when using numpy and cython, use the following:

from libc.stdint cimport int32_t, int64_t
# instead of int and long

Otherwise, you’ll run into issues where an np.int64 is a long for linux and a long long for windows.

0reactions
jay-thakurcommented, May 27, 2020

Ok. I’m closing this issue then. Thanks for testing it out. I’ll be a bit more diligent about keeping cython platform independent. To anyone out there who’s looking to make platform independent code when using numpy and cython, use the following:

from libc.stdint cimport int32_t, int64_t
# instead of int and long

Otherwise, you’ll run into issues where an np.int64 is a long for linux and a long long for windows.

Hi @akaszynski ,

I am facing similar issue while running a git code on windows, posted issue here . Could you please help me.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Buffer dtype mismatch, expected 'Python object' but got 'long ...
This error is coming because of mismatch in index of both dataframe when you try to concat it. I figured out the way...
Read more >
Buffer dtype mismatch, expected 'double' but got 'long' · Issue ...
I'm using models from statsmodels.tsa to do time series analysis and I ran into issue of : ValueError: Buffer dtype mismatch, expected 'double' ......
Read more >
ValueError: Buffer dtype mismatch, expected 'long' but got ...
I am trying to run test diagnostics on a trained model. The model throws an issue ValueError: Buffer dtype mismatch, expected 'long' but...
Read more >
ValueError: Buffer dtype mismatch, expected 'long_t' but got ...
This error comes from cnp.long_t being different than the C Cython type identifier long. (with cimport numpy as cnp). Strangely, this error does ......
Read more >
Buffer dtype mismatch, expected 'Python object' but got 'long ...
ValueError : Buffer dtype mismatch, expected 'Python object' but got 'long long' ; TypeError: expected string or bytes-like object · twinpiques ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found