Open gboeing opened 1 year ago
Looks like this is targeted for release in rasterio 1.4.0 around August 2023.
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 ?
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.
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).
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: https://github.com/rasterio/rasterio/pull/2699#issuecomment-1703244033
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 https://github.com/rasterio/rasterio/issues/2573#issuecomment-1368135052).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.