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

drop GDAL dependency #916

Open
gboeing opened this issue Jan 5, 2023 · 5 comments
Open

drop GDAL dependency #916

gboeing opened this issue Jan 5, 2023 · 5 comments

Comments

@gboeing
Copy link
Owner

gboeing commented Jan 5, 2023

OSMnx currently depends on GDAL directly in the elevation module to build VRTs, because rasterio doesn't expose equivalent functionality directly. However, it's not a good idea to import both rasterio and GDAL into the same working environment (see rasterio/rasterio#2573 (comment)).

Rasterio devs are currently proposing new functionality that would allow us to build VRTs directly with rasterio. If so, we could drop the GDAL dependency. See this issue and this PR.

@gboeing
Copy link
Owner Author

gboeing commented May 4, 2023

Looks like this is targeted for release in rasterio 1.4.0 around August 2023.

@12rambau
Copy link

Simple question, once direct dependency to GDAL will be dropped, will it be possible to install osmnx back with pip only or is there still other dependencies that cannot be handled by pure Python installation ?

@gboeing
Copy link
Owner Author

gboeing commented Jul 22, 2023

Hi @12rambau. The answer is nuanced, so let me provide some details.

First, GDAL is an optional dependency, so even now it's not directly required by OSMnx itself unless you need to work with raster elevation data. But...

Second, OSMnx depends on GeoPandas, which in turn depends on fiona, shapely, and pyproj. Those three packages in turn depend on the GEOS, GDAL, and PROJ libraries, all of which are written in C/C++. So, not pure Python. And that is where the installation can get tricky, depending on your system's configuration and the availability of pre-built binaries for it.

Third, it's often possible to install OSMnx (and all of its dependencies) with pip... it's just not officially supported. There are too many variables with pip installation regarding platforms, system configuration, and binary availability for us to guarantee that it will work for everyone. This has nothing to do with OSMnx itself... it's just the dependencies of the dependencies that are not Python, so it's outside of our control. That said, I sometimes use pip to install OSMnx in Google Colab or in a test environment on one of my machines, and it works. It won't necessarily work for everyone, so we don't officially support it. If it works for you, great! If not, Conda installation is fully tested and supported.

To summarize:

Even if OSMnx no longer directly depends on GDAL itself, its dependencies still will, and your package manager will need to be able to install C/C++ libraries. Conda handles this seamlessly, whereas pip may or may not depending on the specifics of your system. That's why Conda is the standard installer across the Python geospatial science ecosystem.

@12rambau
Copy link

Thanks for the detailed answer, I know that conda is the prefered way of managing environment in the scientific ecosystem in general and that's why I'm using it on my personal computers but for a reason I cannot explain, the places where I work are always not supporting conda on their VM, cloud services, whatever...

That's very good also to know that your main fear is Geopandas and pyproj for which I never experienced a single bug installing it with pip.

I think my usage of osmnx will grow in my new position, I think I'll try to contribute for packaging related issues (as you maintained an outstanding clear board for any other type of issues).

@gboeing
Copy link
Owner Author

gboeing commented Mar 2, 2024

The upstream rasterio work for this issue has been deferred to v1.5.0 and currently does not appear to be in active development anymore: rasterio/rasterio#2699 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants