This is a new environment, that I created following the steps:
conda create -n geo python=3.9
conda activate geo
conda install geopandas, gdal, shapely
conda install geospatial -c conda-forge
I have gdal 3.6.2; geopandas 0.12.2, geospatial 0.8.0, shapely 2.0.1 and python 3.9.18
Any idea how can I fix it? I already tried creating new envs installing first gdal, them geopandas etc. but still same error…
@JVB, can you show the complete output of conda list? It might be some issue with clashing channels. So, I see the geopandas is not from conda-forge, and there might be other packages which are pulled in from default channel.
Please make sure to install from one channel (conda-forge preferably) only, if possible at all.
Errors like we see here are often induced by one package X from channel A trying to use code from package Y from channel B. If both channels differ somehow (eg. Compilers, dependencies etc) things can go terribly wrong.
I meticulously followed the steps outlined in the link, but gives the first error I mentioned when importing GDAL.
In an effort to resolve the issue, I removed the environment and created a new one. I installed GDAL alongside GeoPandas before attempting to install geospatial again, but this also proved unsuccessful.
Lastly, I tried updating GDAL to see if that would resolve the problem, but unfortunately, the update did not succeed.
I’m assuming you are on windows OS and following the mentioned geospatial installation instructions. Although they mention to install from default-channel I’d first try the below and see how it goes.
The issue they refer to is closed already, so good chance that problem is already resolved. Another thing, are you bound to use Python 3.9? If not you might also check Python 3.10 /3.11 environments.
This will install the requested python version into new environment mygeo and only uses conda-forge channel for the requested package (-c conda-forge) also for any dependencies (--overide-channels).
Hi @kmuehlbauer, I don’t need Python 3.9; it’s a new environment. I just need these libraries to work together. I have tried doing it this way, but the packages are not available in the channels:
My solution was to give up on the geospatial package and install all the libraries separately (only the ones I’m certain I need). I have installed in Python 3.12, with conda forge. Thank you for your help.