[PYTHON] What to do if GeoPandas installation fails (Fiona / GDAL error * Rtree installation method is also added)

Depending on the Python environment, installing GeoPandas using pip seems to fail. I failed. So make a note of the solution. (This article describes what to do if you get a "Fiona" related error while installing GeoPandas.)

Python environment

This procedure uses Python 3.7.5. Basically, it works if it is 3.7 series, so if you have not installed Python yet, please install it from here. https://www.python.org/downloads/release/python-375/

Also, please install pip at the same time. https://qiita.com/suzuki_y/items/3261ffa9b67410803443

What you need to install GeoPandas

If you are looking at this page, you probably have failed to install GeoPandas once. At that time, did you get an error message about the module called Fiona? (If not, the content on this page may not be the solution)

GeoPandas requires Fiona, without which the installation will fail. And since Fiona requires a module called GDAL, installation of Fiona will fail without it.

so,

GDAL ↓ Fiona ↓ GeoPandas

Let's install in the order of. However, this installation does not work from pip.

Install GDAL

Please download GDAL-3.0.3-cp37-cp37m-win_amd64.whl from the following site (GDAL-3.0.3-cp37-cp37m-win32.whl for 32-bit PC). The "3.0.3" part is subject to change. https://www.lfd.uci.edu/~gohlke/pythonlibs/#gdal

Place the file in a suitable folder and install it with the following command.

python -m pip install c:/python/codes/geo/GDAL-3.0.3-cp37-cp37m-win_amd64.whl

Here, the files are placed in C: / python / codes / geo.

Install Fiona

As with GDAL, download Fiona-1.8.13-cp37-cp37m-win_amd64.whl from the following site (same page as GDAL) (Fiona-1.8.13-cp37-cp37m for 32-bit PC) ----- Win32.whl). The "1.8.13" part is subject to change. https://www.lfd.uci.edu/~gohlke/pythonlibs/#fiona

Place the file in the same folder as GDAL and install it with the following command.

python -m pip install c:/python/codes/geo/Fiona-1.8.13-cp37-cp37m-win_amd64.whl

Install GeoPandas

Now you are ready to go.

pip install geopandas

You should be able to install GeoPandas with.

(Bonus) Installation of Jupyter

For analysis using GeoPandas, it is convenient to use Jupyter Notebook.

pip install jupyter

Let's install it with. Go to the folder you want to analyze and

jupyter notebook

You can start it with.

(Addition) Installation of Rtree

As you use GeoPandas, you may need a module called "Rtree". I became However, this also doesn't work with pip, so I use the same site as Fiona and GDAL. Download Rtree-0.9.3-cp37-cp37m-win_amd64.whl (Rtree-0.9.3-cp37-cp37m-win32.whl for 32-bit PCs). The "0.9.3" part is subject to change. https://www.lfd.uci.edu/~gohlke/pythonlibs/#rtree

Place the file in the same folder as GDAL / Fiona and install it with the following command.

python -m pip install c:/python/codes/geo/Rtree-0.9.3‑cp37‑cp37m‑win_amd64.whl

Recommended Posts

What to do if GeoPandas installation fails (Fiona / GDAL error * Rtree installation method is also added)
What to do if SciPy installation fails on CentOS
What to do if package installation fails when deploying to heroku
What to do if "Unnamed: 0" is added in to_csv-> read_csv in pandas
Note: What to do if pip install fails
What to do if pip install fails in Xcode 5.1
What to do if pip install fails to install dependent libraries
What to do if pyenv is not enabled (zsh)
What to do if ʻarguments [0] .scrollIntoView ();` fails in python selenium
What to do if `pip install matplotlib` fails on Mac
What to do if pip install mysqlclient fails on MacOS
What to do if the inode is exhausted on EC2 Linux
What to do if yum breaks
What to do if PyInstaller3.5 gives an error in Python3.8 (TypeError: an integer is required (got type bytes))
What to do if there is a decimal in python json .dumps
What to do if the Pipenv environment is corrupted by updating Homebrew
What to do if the yum command fails to set locale, defaulting to C
What to do if you get stuck during Anaconda installation on Linux
What to do if pyenv install does not proceed with an error
What to do if an error occurs when importing numpy with VScode
What to do if you get an error when trying to load mnist
What to do if you get an error when installing Dlib (Ubuntu)
[Python] What to do if an error occurs in pip (pyinstaller, pyautogui, etc.)
What to do if you get a "No versions found" error in pipenv
What to do if CERTIFICATE_VERIFY_FAILED occurs when nltk.download () is done on macOS pyhon
What to do if a Unicode Encode Error occurs in Sublime Text Python
What to do if you get an error when installing python with pyenv
What to do if abort is displayed when inputting camera video in OpenCV
What to do if a version error occurs in the selenium Chrome driver
What to do if Japanese language support is not completely installed on Ubuntu 16.04
What to do if an SSL connection error (ssl.SSLError: [SSL: DH_KEY_TOO_SMALL]) occurs on Ubuntu 20.04
What to do if (base) is displayed at the beginning of the Mac terminal
What to do if pipreqs results in UnicodeDecodeError
What to do if you can't pipenv shell
What to do if mod_fcgid cannot resolve UnicodeEncodeError
What to do if rails s doesn't work
What to do if pip cannot be installed
What to do if atom autocomplete-python doesn't work
What to do if Docker-sync suddenly stops working
What to do if "amazon-linux-extras" → "No module named amazon_linux_extras"
[Python] Type Error:'WebElement' object is not iterable What to do when an error occurs
What to do if you get an "unknown service" error from your gRPC server
What to do if ubuntu says your password is too short to change [passwd command] [ubuntu]
What to do if you get a memory error when converting from PySparkDataFrame to PandasDataFrame
What to do if you get "(35,'SSL connect error')" in pycurl (one of them)
What to do if you get an error when importing matplotlib in Python (Mac)
What to do if the progress bar is not displayed in tqdm of python
What to do if you get an Import Error when importing matplotlib with Jupyter
What to do if you get the error ʻERR_FEATURE_UNAVAILABLE_ON_PLATFORM` when using ts-node-dev on Linux
What to do if you run python in IntelliJ and end with an error