Comments (9)
What version of dask (and dask-expr, maybe) do you have installed?
from dask-geopandas.
Here I attached the pack versions.
dask 2024.4.1
dask-geopandas 0.3.1
THK!
from dask-geopandas.
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.
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.
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.
@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)
- Unpin sphinx-book-theme HOT 1
- Add support for Pandas 2.0.0 `dtype_backend` argument in `read_feather`
- read parquet from s3 failing with 'GeoArrowEngine' has no attribute 'extract_filesystem' HOT 3
- 0.3.1 release HOT 2
- dtype('O') not supported since geopandas 0.13.0
- Spatial_shuffle() can result in ArrowTypeError when using pyarrow 12 HOT 5
- FeatureError from filegdbtable.cpp when reading file HOT 2
- Drop distributed as a required dependency? HOT 1
- Question regarding parallelism over many seperate GeoSeries HOT 2
- dask geopandas to parquet does not seem to persist spatial paritions HOT 1
- Can someone answer why the number and x columns of '201105. shp' in the output of this code also become 0? HOT 1
- msgpack - ValueError: 2369781118 exceeds max_bin_len(2147483647 HOT 1
- Remove dask anti-pattern example on README and docs HOT 1
- DeprecationWarning: underlying geometries through the `.data` attribute is deprecated HOT 1
- Error when reading geoparquet file HOT 3
- Support latest dask.dataframe with query planning (dask-expr) HOT 3
- ddf._meta_nonempty doesnt instantiate correctly when calling `from_dask_dataframe` HOT 1
- BUG: `to_parquet()` failing with `dask=2024.4.1` HOT 2
- Uninformative AttributeError for aggregation methods
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dask-geopandas.