how to successfully install pyproj and geopandas? how to successfully install pyproj and geopandas? python python

how to successfully install pyproj and geopandas?


Thanks to the conda-forge community, geopandas is actually pretty easy to install on all platforms using the conda package manager (or: its dependencies, as this is the difficulty).

If you have conda, it is just:

conda install -c conda-forge geopandas

To install conda, you can install the Anaconda python distribution or miniconda: http://conda.pydata.org/docs/download.html

See the GeoPandas docs for more details, specifically on how to create a new environment with GeoPandas installed with settings to ensure this always works: https://geopandas.org/install.html#creating-a-new-environment


Getting to work geopandas is unfortuntaly not easy, the problem is that the dependencies are partly not working and you have to use older versions of Fiona and GDAL. The following packages work stable together:

GDAL: 1.11.2Fiona: 1.6.0Geopandas: 0.1.0.dev-

To install on ubuntu:

sudo apt-get install build-essential python-all-devwget http://download.osgeo.org/gdal/1.11.2/gdal-1.11.2.tar.gztar xvfz gdal-1.11.2.tar.gzcd gdal-1.11.2./configure --with-pythonmakesudo make install

In addition, some Linux distributions require the shared library cache to be updated after install:

sudo ldconfig

Fiona and geopandas can be installed classic by:

sudo pip install Fiona==1.6.0sudo pip install geopandas

Under windows

As @Marcus Williams states:

Download Fiona and GDAL Windows Binaries corresponding your python environment (32, 64bit and 2.7 3.3 etc. (from http://www.lfd.uci.edu/~gohlke/pythonlibs/) and go in cmd with cd to directory where downloaded files are and install the .whl files using the command

pip install filename.whl

Finally:

pip install geopandas


I recently destroyed my Anaconda 5.2 distribution by trying to upgrade from Geopandas 0.3.0 to 0.4.0. I didn't notice that command conda install -c conda-forge geopandas wanted to upgrade a bunch of packages, downgrade others, and remove Anaconda 5.2.

Anyway, after reinstalling Anaconda 5.2 I ran into several Command "python setup.py egg_info" failed with error code 1 in <filepath> errors with no ways around it. I even tried installing Anaconda 5.2 on a different computer, still same error message.

I then stumbled on this website Geoff Boeing: Using geopandas on Windows. It did the trick for me. In case this link stops functioning at some point, I'll just copy-paste the contents below.

My notes: I installed cp36-versions from Gohlke as Anaconda 5.2 comes with Python 3.6.5. My Anaconda installation was installed by default to C:\Users\<Username>\AppData\Local\Continuum\anaconda3\Lib\site-packages so I used that as the environment variable.

Installing geopandas and its dependencies manually

  1. First and most important: do not try to directly pip install orconda install any of the dependencies – if you do, they will fail insome way later, often silently or obscurely, making troubleshootingdifficult. If any are already installed, uninstall them now.
  2. Download the wheels for GDAL, Fiona, pyproj,rtree, and shapely from Gohlke. Make sure you choose thewheel files that match your architecture (64-bit) and Python version(2.7 or 3.x). If Gohlke mentions any prerequisites in hisdescriptions of those 5 packages, install the prerequisites now(there might be a C++ redistributable or something similar listedthere)
  3. If OSGeo4W, GDAL, Fiona, pyproj, rtree, or shapely is alreadyinstalled, uninstall it now. The GDAL wheel contains a complete GDALinstallation – don’t use it alongside OSGeo4W or otherdistributions.
  4. Open a command prompt and change directories to the folder where youdownloaded these 5 wheels.
  5. pip install the GDAL wheel file you downloaded. Your actual commandwill be something like: pip install GDAL-1.11.2-cp27-none-win_amd64.whl
  6. Add the new GDAL path to the windows PATH environment variable,something like C:\Anaconda\Lib\site-packages\osgeo
  7. pip install your Fiona wheel file, then your pyproj wheel file, thenrtree, and then shapely.
  8. Now that GDAL and geopandas’s dependencies are all installed, youcan just pip install geopandas from the command prompt

Update 21/03/2020: as of Anaconda 2020.02, rtree is now included in the distribution.