Giter Club home page Giter Club logo

Comments (9)

TomAugspurger avatar TomAugspurger commented on July 29, 2024

What version of dask (and dask-expr, maybe) do you have installed?

from dask-geopandas.

TommasoCanc avatar TommasoCanc commented on July 29, 2024

Here I attached the pack versions.

dask 2024.4.1
dask-geopandas 0.3.1

THK!

from dask-geopandas.

anastassiavybornova avatar anastassiavybornova commented on July 29, 2024

I'm running into a similar issue, just trying to run the example code from the dask-geopandas docs:

import geopandas
import dask_geopandas

df = geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres"))
dask_df = dask_geopandas.from_geopandas(df, npartitions=4)

dask_df.geometry.area.compute()

throws the following error:

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File [~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:459](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:459), in Expr.__getattr__(self, key)
    [458](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:458) try:
--> [459](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:459)     return object.__getattribute__(self, key)
    [460](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:460) except AttributeError as err:

AttributeError: 'Projection' object has no attribute 'area'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
File [~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:618](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:618), in FrameBase.__getattr__(self, key)
    [615](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:615) try:
    [616](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:616)     # Fall back to `expr` API
    [617](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:617)     # (Making sure to convert to/from Expr)
--> [618](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:618)     val = getattr(self.expr, key)
    [619](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:619)     if callable(val):

File [~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:480](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:480), in Expr.__getattr__(self, key)
    [479](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:479) link = "https://github.com/dask-contrib/dask-expr/blob/main/README.md#api-coverage"
--> [480](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:480) raise AttributeError(
    [481](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:481)     f"{err}\n\n"
    [482](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:482)     "This often means that you are attempting to use an unsupported "
    [483](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:483)     f"API function. Current API coverage is documented here: {link}."
...
    [615](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:615)         try:
    [616](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:616)             # Fall back to `expr` API
    [617](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:617)             # (Making sure to convert to/from Expr)

AttributeError: 'Series' object has no attribute 'area'

The above is running a Jupyter notebook with a conda environment within VS code. My package versions:

dask                      2024.4.2           pyhd8ed1ab_0    conda-forge
dask-core                 2024.4.2           pyhd8ed1ab_0    conda-forge
dask-expr                 1.0.12             pyhd8ed1ab_0    conda-forge
dask-geopandas            0.3.1              pyhd8ed1ab_1    conda-forge
geopandas                 0.14.3             pyhd8ed1ab_0    conda-forge

from dask-geopandas.

anastassiavybornova avatar anastassiavybornova commented on July 29, 2024

I get comparable error messages (attribute errors from dask-expr) when I try to apply to within or sjoin tools on a dask dataframe created with dask_geopandas.from_geopandas(geopandas.GeoDataFrame). For example:

import numpy as np
import geopandas
import dask_geopandas
N = 100
points1 = dask_geopandas.from_geopandas(
    geopandas.GeoDataFrame(
        geometry=geopandas.points_from_xy(
            np.random.randn(N),np.random.randn(N)
            )
        )
    )
points2 = dask_geopandas.from_geopandas(
    geopandas.GeoDataFrame(
        geometry=geopandas.points_from_xy(
            np.random.randn(N),np.random.randn(N)
            )
        )
    )
points1.sjoin(points2)

throws the error message

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File [~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:459](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:459), in Expr.__getattr__(self, key)
    [458](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:458) try:
--> [459](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:459)     return object.__getattribute__(self, key)
    [460](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:460) except AttributeError as err:

AttributeError: 'FromPandas' object has no attribute 'sjoin'

During handling of the above exception, another exception occurred:

AttributeError                            Traceback (most recent call last)
File [~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:618](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:618), in FrameBase.__getattr__(self, key)
    [615](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:615) try:
    [616](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:616)     # Fall back to `expr` API
    [617](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:617)     # (Making sure to convert to/from Expr)
--> [618](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:618)     val = getattr(self.expr, key)
    [619](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:619)     if callable(val):

File [~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:480](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:480), in Expr.__getattr__(self, key)
    [479](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:479) link = "https://github.com/dask-contrib/dask-expr/blob/main/README.md#api-coverage"
--> [480](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:480) raise AttributeError(
    [481](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:481)     f"{err}\n\n"
    [482](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:482)     "This often means that you are attempting to use an unsupported "
    [483](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_core.py:483)     f"API function. Current API coverage is documented here: {link}."
...
    [615](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:615)         try:
    [616](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:616)             # Fall back to `expr` API
    [617](https://file+.vscode-resource.vscode-cdn.net/Users/anvy/Library/CloudStorage/OneDrive-ITU/projects/socio-spatial-git/code/~/anaconda3/envs/hightest/lib/python3.12/site-packages/dask_expr/_collection.py:617)             # (Making sure to convert to/from Expr)

AttributeError: 'DataFrame' object has no attribute 'sjoin'

not sure if the error might be in how i'm trying to use sjoin here? but the same code that now throws these error messages worked with older package versions, in particular:

>>> geopandas.__version__
‘0.11.1’
>>> dask.__version__
‘2022.7.1’
>>> dask_geopandas.__version__
‘v0.2.0’

from dask-geopandas.

martinfleis avatar martinfleis commented on July 29, 2024

The dask-expr support is in a PR state (#285) so I would not expect dask-geopandas stable release to work with that without issues. You should be able to maually fall back to the old engine using dask.config.set({'dataframe.query-planning': False}).

from dask-geopandas.

anastassiavybornova avatar anastassiavybornova commented on July 29, 2024

@martinfleis thanks for this!! but same error message (and the config is already set to False at import from what I can see), i.e.:

import dask
import geopandas
import dask_geopandas

print(dask.config.config["dataframe"]["query-planning"])
dask.config.set({'dataframe.query-planning': False})
print(dask.config.config["dataframe"]["query-planning"])

df = geopandas.read_file(geopandas.datasets.get_path("naturalearth_lowres"))
dask_df = dask_geopandas.from_geopandas(df, npartitions=4)

dask_df.geometry.area.compute()

... prints out False twice, and then throws the same error message as above. By any chance 😅 any other configs to play around with to fall back to the old engine that come to mind?

from dask-geopandas.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.