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: GEOSGeom_createLinearRing_r returned a NULL pointer while opening in geopandas #1005

Closed
sehHeiden opened this issue Oct 16, 2020 · 5 comments

Comments

@sehHeiden
Copy link

sehHeiden commented Oct 16, 2020

I am using Shapily in verion 1.7.1 and geopandas in version 0.8.1. Want to open a file in geopandas, a esri shape file in geopandas, but an error message from File "shapely\speedups_speedups.pyx", line 408, in shapely.speedups._speedups.geos_linearring_from_py

is returned:
ValueError: GEOSGeom_createLinearRing_r returned a NULL pointer

Expected behavior and actual behavior.

I was able to open the file before (infact today and did not update any package), only restarted the jupyter kernel. Because of some problems with my raster files (ram usage). The same error message is returned for code in jupyter and in script.

Operating system

OS: Windows 10
Environment: Virtualenv
Installation of shaply via pip (from PyPi)

Version:
Shapily 1.7.1
geopandas 0.8.1

Edit: when installalling the packages new with conda in an conda environment, everythink works just fine.

@jorisvandenbossche
Copy link
Member

Hi @Meresmata, that typically means there is something wrong with the GEOS installation / or the version of GEOS that Shapely is finding.
See eg geopandas/geopandas#1652 (note the title about pygeos turned out not to be the issue) and #919 for recent similar issues.

A workaround (but not really solving the underlying issue of course) is to disable the speedups: import shapely; shapely.speedups.disable().

Can you show the output of geopandas.show_versions() ?
Do you get the same issue if you create a new virtual environment and install shapely and geopandas in it?

@sehHeiden
Copy link
Author

Installing everything anew, didn't help.

What seamed to work, was switching shapely form PyPI to https://www.lfd.uci.edu/~gohlke/pythonlibs/#shapely.

@snorfalorpagus
Copy link
Member

I agree with @jorisvandenbossche. Nasty problems like this can happen if you have multiple incompatible installations of GEOS installed on the system. The only solution we have right now is to make sure you get all your packages from the same source, or build from source.

@bright1993ff66
Copy link

I encounter the same problem today. Using the following codes suggested by @jorisvandenbossche solves the problem! Thank you~

import geopandas as gpd
import shapely
shapely.speedups.disable()

My geopandas version is 0.9.0 and my shapely version is 1.7.1

@BluePegas
Copy link

Hi @Meresmata, that typically means there is something wrong with the GEOS installation / or the version of GEOS that Shapely is finding. See eg geopandas/geopandas#1652 (note the title about pygeos turned out not to be the issue) and #919 for recent similar issues.
A workaround (but not really solving the underlying issue of course) is to disable the speedups: import shapely; shapely.speedups.disable().

Thanks a lot. It does work. But may I ask you why it can be useful, and what's the function of shapely.speedups? And after using disable(), what's the influence on the code, and what will happen using 'shapely.speedups.disable()'? Does the code run slower after using that?

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

5 participants