简体   繁体   中英

Issues installing Geopandas

I tried pip install geopandas

When I run that, I get this error:

Collecting geopandas
  Using cached geopandas-0.8.1-py2.py3-none-any.whl (962 kB)
Collecting pyproj>=2.2.0
  Using cached pyproj-2.6.1.post1-cp37-cp37m-win_amd64.whl (17.2 MB)
Requirement already satisfied: pandas>=0.23.0 in c:\users\ryans\anaconda3\lib\site-packages (from geopandas) (1.0.1)
Collecting fiona
  Using cached Fiona-1.8.17.tar.gz (1.3 MB)
    ERROR: Command errored out with exit status 1:
     command: 'C:\Users\ryans\anaconda3\python.exe' -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\\Users\\ryans\\AppData\\Local\\Temp\\pip-install-cw2z1439\\fiona\\setup.py'"'"'; __file__='"'"'C:\\Users\\ryans\\AppData\\Local\\Temp\\pip-install-cw2z1439\\fiona\\setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base 'C:\Users\ryans\AppData\Local\Temp\pip-install-cw2z1439\fiona\pip-egg-info'
         cwd: C:\Users\ryans\AppData\Local\Temp\pip-install-cw2z1439\fiona\
    Complete output (1 lines):
    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.
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

I also tried conda install -c conda-forge geopandas

In this case, everything runs fine, but when I try to run this one-liner:

import geopandas as gpd

I get this result:

ModuleNotFoundError: No module named 'geopandas'

I'm guessing that there is some kind of conflict with some other library that is installed, but it's just a guess, and I don't know for sure what the problem is. How can I get this thing to work? Thanks!!

You can try it

$ conda install -c anaconda pip
$ pip install geopandas
$ pip install Fiona

For me this installation worked (even without Anaconda). Get the GDAL package from here (Gohlke)

Install it with pip install GDAL_..._.whl

Upon installing the same error will occur, but no problem! Go to the system environment variables and create a new system variable and name it GDAL_VERSION and give it the value of the package version. Looks like this:

GDAL 环境变量

Then try to install GDAL again and it will work (maybe you need to restart the console). Then install geopandas with pip install geopandas and everything should work.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM