Search code examples
pythonpipgeopandasgdal

Error when installing 'geopandas' in cmd terminal


I ran into this problem while trying to install geopandas using this command in the command prompt. "pip install geopandas"

This is the error message I got.

C:\WINDOWS\system32>pip install geopandas 
Collecting geopandas
Using cached geopandas-0.11.1-py3-none-any.whl (1.0 MB)                                                               
Requirement already satisfied: packaging in 
c:\users\sasika\appdata\roaming\python\python38\site-packages (from geopandas) (21.3)                                                                                                               
Collecting fiona>=1.8                                                                                                     
Using cached Fiona-1.8.21.tar.gz (1.0 MB)                                                                               
Preparing metadata (setup.py) ... error                                                                                 
error: subprocess-exited-with-error                                                                                                                                                                                                             
× python setup.py egg_info did not run successfully.                                                                    
│ exit code: 1                                                                                                          
╰─> [1 lines of output]                                                                                                     
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.                                                                                        
[end of output]                                                                                                                                                                                                                             
note: This error originates from a subprocess, and is likely not a problem with pip.                                  
error: metadata-generation-failed                                                                                                                                                                                                               
× Encountered error while generating package metadata.                                                                  
╰─> See above for output.                                                                                                                                                                                                                       
note: This is an issue with the package mentioned above, not pip.                                                       
hint: See above for details.

Thank you so much in advance!


Solution

  • Pip is good for some simple installation tasks, such as pure-python installs. If complex binary deps are getting you down, a more sophisticated tool would be a better match for your needs.

    Create / activate an empty conda environment, and then follow the install instructions:

    $ conda install -c conda-forge geopandas