Geopandas installation error:” A GDAL API version must be specified ” in Anaconda

Geopandas installation error:” A GDAL API version must be specified ” in Anaconda is an error which occurs when you mix env managers.

In this article I am going to explain why the error is happening and how to understand it and solve it and run your code without getting the error again. Also we are going to check out other solutions that may work for your particular case.

Explaining Geopandas installation error:” A GDAL API version must be specified ” in Anaconda

First of all, reproducing the error is easy since the error happens frequently when you try to install Geopandas.

Bellow is how the error looks like.

                                                                       #
Complete output from command python setup.py egg_info:
A GDAL API version must be specified. Provide a path to gdal-config using a GDAL_CONFIG environment variable or use a GDAL_VERSION environment variable.
                                                                       #

In the sections bellow we will explain the root of the error more and propose some possible fixes.

Solution 1 : This is how to install Geopandas correctly

Most people do not know how to install Geopandas correctly even when the documentation of Geopandas is clear and everything is in their website, bellow is a step by step guide of what to do in order to get Geopandas to work without getting any errors.

First, we should start by installing wheel

To do that, you should run the command bellow.

                                                                       #
pip install wheel
                                                                       #

After that we should install pipwin, we are going to use pipwin to install everything after this, to do that run the command bellow.

                                                                       #
pip install pipwin
                                                                       #

Now run the commands bellow in order to install all the packages one by one.

                                                                       #
pipwin install pandas
pipwin install numpy
pipwin install gdal
pipwin install shapely
pipwin install fiona
pipwin install rtree
pipwin install six
pipwin install pyproj
pipwin install geopandas
                                                                       #

You can also follow this process in a virtual env. I would say that the solution above should fix the issue in most cases, but if it does not do that we have another solution bellow.

Solution 2 : install geopandas through the Anaconda Navigator

Another solution to easily install Geopandas is to use the anaconda navigator

First, open the Anaconda Navigator.

Install the package ‘geopandas’

Import the geopandas package in spyder

I hope this guide solved your problem, share this with fellow developers. Thank you for reading.

Summing-up

Thank you for reading, we are at the end of this article, I did my best to help you solve the error Geopandas installation error:” A GDAL API version must be specified ” in Anaconda with this guide and included the solution that worked for me and other solutions that I found relevant.

Thanks, keep coding and cheers. If you want to learn more about Python, please check out the Python Documentation : https://docs.python.org/3/