简体   繁体   中英

pip install geopandas on windows

I am relatively new to python and trying to install geopandas on python 3.7 using pip. For separate reasons, I would like to avoid using the anaconda distribution. Following this post , I was able to successfully install geopandas by first installing the dependencies manually. The problem is that now I run into a problem when I try to import geopandas:

import geopandas

The subsequent error message is:

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\geopandas\__init__.py", line 5, in <module>
from geopandas.io.file import read_file

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\geopandas\io\file.py", line 4, in <module>
import fiona

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\fiona\__init__.py", line 87, in <module>
from fiona.collection import BytesCollection, Collection

File "C:\Users\Administrator\AppData\Local\Programs\Python\Python37-32\lib\site-packages\fiona\collection.py", line 9, in <module>
from fiona.ogrext import Iterator, ItemsIterator, KeysIterator

ImportError: DLL load failed: The specified module could not be found.

Any advice would be greatly appreciated

My case is similar to yours. And here is how I got mine setup:

Platform: Windows 10, 64-bit Python Version: Python 3.7

Dependencies (whl files needed):

  1. GDAL‑3.0.4‑cp37‑cp37m‑win_amd64.whl
  2. Fiona‑1.8.13‑cp37‑cp37m‑win_amd64.whl
  3. pyproj‑2.6.0‑cp37‑cp37m‑win_amd64.whl
  4. Rtree‑0.9.4‑cp37‑cp37m‑win_amd64.whl

Steps :

  1. Download the files that match the platform and Python version from

    https://www.lfd.uci.edu/~gohlke/pythonlibs/

  2. Install packages (stick with the order)

a) C:\\Users...\\Python37\\Scripts>pip3.7 install C:...\\GDAL‑3.0.4‑cp37‑cp37m‑win_amd64.whl

b) C:\\Users...\\Python37\\Scripts>pip3.7 install C:...\\Fiona‑1.8.13‑cp37‑cp37m‑win_amd64.whl

c) C:\\Users...\\Python37\\Scripts>pip3.7 install C:...\\pyproj‑2.6.0‑cp37‑cp37m‑win_amd64.whl

d) C:\\Users...\\Python37\\Scripts>pip3.7 install C:...\\Rtree‑0.9.4‑cp37‑cp37m‑win_amd64.whl

  1. Given no errros, now it's good to go:

C:\\Users...\\Python37\\Scripts>pip3.7.exe install geopandas

  1. Test it using IDEL 3.7.4

    import geopandas as pdg

(It works!)

This works for me and I hope this is also helpful for you.

Possibly duplicate of how to successfully install pyproj and geopandas?

我在 (win-64, Spyder3.8, Python3.8.3) 上安装 geopandas 时遇到问题 使用此表达式在 anaconda 提示符下安装 geopandas: conda install -c conda-forge/label/cf202003 geos (不要使用本网站: https: //geopandas.org/install.html )(不要使用这个表达式:conda install --channel conda-forge geopandas)

The simplest method to install geopandas is:

conda install geopandas

In order to update geopandas to latest version use the following command after installation by conda :

pip install geopandas --upgrade 

There are other installation methods also explained in Geopandas official website .

Conda is really powerful when it comes to installation as it will install the dependencies needed by the package. However, if you would like to install dependencies earlier than use the following command:

conda install pandas fiona shapely pyproj rtree descartes

Note that if you have installed the dependencies using above command then you can also use pip to install geopandas but before installing via pip dependencies are required to be installed. In order to read more about dependencies, please follow the official guide . To install using pip use the following command:

pip install geopandas

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