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

RuntimeWarning when using pyshp 2.1.1 #203

Closed
hashstat opened this issue Sep 9, 2020 · 4 comments
Closed

RuntimeWarning when using pyshp 2.1.1 #203

hashstat opened this issue Sep 9, 2020 · 4 comments
Labels

Comments

@hashstat
Copy link

hashstat commented Sep 9, 2020

We've been using pyshp 2.1.0 successfully in our large project for months now. Today, with the introduction of version 2.1.1, I am now seeing this runtime warning when I run our application:

/home/user/.pyenv/versions/3.7.7/lib/python3.7/importlib/_bootstrap.py:219: RuntimeWarning: numpy.ufunc size changed, may indicate binary incompatibility. Expected 192 from C header, got 216 from PyObject
  return f(*args, **kwds)

It threw me off because pyshp doesn't depend on numpy at all, but downgrading pyshp eliminates the warning. Have you ever seen this before? Any thoughts on how pyshp could be involved in this issue?

I'm able to reproduce this on both Linux and Windows. I haven't tried on Macos, but I'm guessing it will be an issue there as well.
I'm using 64-bit versions of Python 3.7.7. My applications depends on Pandas, numpy, scipy, and a host of other packages. I'll dig into the issue more, but thought you could provide some insight, or at least a starting point.

Thanks!

@karimbahgat
Copy link
Collaborator

Yes, that is indeed weird. But come to think of it I noticed some similar numpy errors when I ran some unrelated code that also used pyshp.

The only thing I can think of that may cause this is that as part of the recent changes I added warnings.simplefilter('always') upon import, because I wanted it to raise a warning each time pyshp encountered invalid polygons, not just the first time which I think is the warning module's default. I suspect that maybe that changes the warning behavior in all your other codebase as well, thus making visible some scipy/pandas/numpy warnings that were already there but that perhaps were suppressed in the past.

Removing the warning simplefilter line fixed it for me, so this must be the culprit. Pushing a new v2.1.2 to fix the issue.

@karimbahgat
Copy link
Collaborator

Could you confirm that the newest changes I just pushed to GitHub fixes the warnings issue in your case?

@hashstat
Copy link
Author

Just confirmed that your fix quiets the warnings. Built and installed v2.1.2 from master and everything is working as usual.

Thanks for your quick response to this issue!

@karimbahgat
Copy link
Collaborator

No worries, trying to improve my response time, and that warnings issue would likely be a serious nuisance to many. Thanks a lot for pointing it out so fast!

New v2.1.2 out on PyPI now.

brandon-avantus pushed a commit to avantus-tech/these-united-states that referenced this issue Mar 11, 2025
Blacklist pyshp 2.1.1 due to warnings issue.

See GeospatialPython/pyshp#203

Fixes NN-1738
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants