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

ENH: check for minimum version of folium #2187

Open
martinfleis opened this issue Oct 18, 2021 · 4 comments
Open

ENH: check for minimum version of folium #2187

martinfleis opened this issue Oct 18, 2021 · 4 comments

Comments

@martinfleis
Copy link
Member

I've found that we require some recent version of folium with explore. I haven't yet checked which is needed but 0.8.3 that comes pre-installed in Google Colab is too old and raises an error. We should capture that and raise an informative error, instead of existing coming from folium (something about missing 1 required positional argument: “location”).

In case someone stumbles upon this issue trying to resolve Google Colab, just update folium.

!pip install folium -U
@jorisvandenbossche
Copy link
Member

Do you have the full traceback? If it's only about a single keyword, it might also be relatively easy to fix that in geopandas to avoid this small annoyance.

@martinfleis
Copy link
Member Author

It is not about a keyword, it doesn't work at all. It happens during the initialization of a default marker type (even though the marker itself is not used).

import geopandas

df = geopandas.read_file(geopandas.datasets.get_path("nybb"))
df.explore()

TypeError                                 Traceback (most recent call last)
<ipython-input-3-087623d14df8> in <module>()
      2 
      3 df = geopandas.read_file(geopandas.datasets.get_path("nybb"))
----> 4 df.explore()

1 frames
/usr/local/lib/python3.7/dist-packages/geopandas/explore.py in _explore(df, column, cmap, color, m, tiles, attr, tooltip, popup, highlight, categorical, legend, scheme, k, vmin, vmax, width, height, categories, classification_kwds, control_scale, marker_type, marker_kwds, style_kwds, highlight_kwds, missing_kwds, tooltip_kwds, popup_kwds, legend_kwds, **kwargs)
    511             marker_kwds["radius"] = marker_kwds.get("radius", 2)
    512             marker_kwds["fill"] = marker_kwds.get("fill", True)
--> 513             marker = folium.CircleMarker(**marker_kwds)
    514         else:
    515             raise ValueError(

TypeError: __init__() missing 1 required positional argument: 'location'

https://colab.research.google.com/drive/1aJySwBvJvYDaAinDZwQ0R9riEqbtwqvn?usp=sharing

@jorisvandenbossche
Copy link
Member

It seems the change to have location to be a non-required keyword was done in python-visualization/folium#957, which was merged a bit less than a year ago (which I think corresponds to 0.12.0, basically the last version).

There might of course be other issues, but it should be rather straightforward to add a location=None when constructing those markers.

@martinfleis
Copy link
Member Author

The minimum required by GeoPandas now is 0.12 (corresponding to NEP29 now). We can potentially check for that as a minimum version and raise an error if an older is installed but I am not sure how important that is now when 0.14 is the latest version.

@martinfleis martinfleis removed this from the 0.13 milestone Dec 31, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants