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

Remove GeoPandas dependency #18

Closed
mdtanker opened this issue Jul 25, 2022 · 8 comments
Closed

Remove GeoPandas dependency #18

mdtanker opened this issue Jul 25, 2022 · 8 comments
Labels
bug Something isn't working dependencies
Milestone

Comments

@mdtanker
Copy link
Owner

mdtanker commented Jul 25, 2022

Description of the desired feature:

GeoPandas is causing some issues with Poetry and packaging/install on a Windows machine, I think mostly due to its C dependencies. Since we only use it to read shapefiles, there might be an alternative.

Are you willing to help implement and maintain this feature?

@mdtanker
Copy link
Owner Author

Two more thinks to consider:

@weiji14
Copy link

weiji14 commented Jul 26, 2022

Have you checked out https://github.com/geopandas/pyogrio?

@mdtanker
Copy link
Owner Author

Look's like it still requires GeoPandas to read a .shp 😑, so I think I'd still need to include GeoPandas in the .toml dependencies, which won't work on Windows, unless I'm missing something. Thanks though 😄

@weiji14
Copy link

weiji14 commented Jul 26, 2022

Ah yes, that's true. But I think pyogrio also ships with GDAL in the wheels (see geopandas/pyogrio#48, geopandas/pyogrio#112 (comment), and notice at https://pypi.org/project/pyogrio/0.4.1/#files how the .whl files are quite big) whereas geopandas on PyPI doesn't ship with GDAL (so you need to do conda install gdal). In other words, if you do pip install pyogrio[geopandas], you should be indirectly getting GDAL already without going through conda, if that was the original issue on Windows. That said, I've not tested this so not sure how well it works in practice.

For reference, if you're using poetry, the pyogrio[geopandas] dependency line would look like pyogrio = {version = ">=0.4.0", extras = ["geopandas"]} (e.g. at https://github.com/weiji14/zen3geo/blob/71e886d95454de70651cc31ea6dedc33e929145c/pyproject.toml#L25)

@mdtanker
Copy link
Owner Author

Amazing! Thanks for that 👍 I originally tried pip install pyogrio[geopandas] which wasn't working, but pip install --pre pyogrio[geopandas] did the trick. I'll add that in my .toml to save some hassle for separately install geopandas with conda.

Any idea if a similar approach will be taken withPyGMT to include GMT in a pip install?

@weiji14
Copy link

weiji14 commented Jul 26, 2022

Amazing! Thanks for that 👍 I originally tried pip install pyogrio[geopandas] which wasn't working, but pip install --pre pyogrio[geopandas] did the trick. I'll add that in my .toml to save some hassle for separately install geopandas with conda.

Cool, glad that it worked!

Any idea if a similar approach will be taken withPyGMT to include GMT in a pip install?

Some day perhaps, see GenericMappingTools/pygmt#1853 😉

@mdtanker mdtanker added the bug Something isn't working label Jul 26, 2022
@mdtanker mdtanker added this to the v.0.0.4 milestone Jul 26, 2022
@mdtanker
Copy link
Owner Author

I've tried to replace geopandas with pyogrio in poetry, but am still having issues. It worked fine to just add pyogrio, but to read a shapefile, geopandas still needs to be installed. This can be done with pip install geopandas --no-deps, but I haven't found a way to get poetry to add geopandas without also adding its dependency fiona, which causes issues on windows.

For now I've added pyogrio to the dependencies, but will inform users to separately install geopandas.

@mdtanker
Copy link
Owner Author

We now use Geopandas for more than just reading shapefiles, so for now will close this as it is a core dependency.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies
Projects
None yet
Development

No branches or pull requests

2 participants