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

Bug with pygeos makes sjoin fail #272

Closed
LucaMarconato opened this issue May 19, 2023 · 2 comments
Closed

Bug with pygeos makes sjoin fail #272

LucaMarconato opened this issue May 19, 2023 · 2 comments

Comments

@LucaMarconato
Copy link
Member

If incompatible versions of pygeos, geopandas and shapely are installed one may encounter bugs with geopandas or reduced performance. In an extreme case I just saw sjoin fail with the following error:

...
  File "/Users/macbook/miniconda3/envs/ome/lib/python3.11/site-packages/pygeos/decorators.py", line 80, in wrapped
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/macbook/miniconda3/envs/ome/lib/python3.11/site-packages/pygeos/predicates.py", line 159, in is_empty
    return lib.is_empty(geometry, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: One of the arguments is of incorrect type. Please provide only Geometry objects.

We should investigate better which versions of shapely, geopandas and pygeos are compatible and we recommend and report the incompatible versions to the developers of the respective libraries.

A workaround in case this happens is to add this in the code before import geopandas, shapely or pygeos

# isort: off
import os

# os.environ["USE_PYGEOS"] = "0"
# isort:on

or to set the following in bash before running the code

export USE_PYGEOS=0
@lopollar
Copy link

lopollar commented Jul 4, 2023

Thank you for this issue, had the same problem and not using pygeos solved the problem, amazing.

@LucaMarconato
Copy link
Member Author

Fixed with #545

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