PAI 789 Advanced Policy Analysis > Software Packages

Geopandas

The Python geopandas module is very powerful but isn't part of the default Anaconda distribution. It has complex links to a bunch of other packages so it can be a little fiddly to install. The steps below should work on the Anaconda distribution we've been using for class. The whole process takes longer than you'd expect: it can be anywhere between 10 and 30 minutes. If anything goes wrong, let me know and we'll set up a Zoom call to get things straightened out.

  1. Close all Spyder and Anaconda windows
  2. This is necessary to make sure that no Anaconda files are in use during the process because that could keep them from being updated.

  3. Open an Anaconda command line prompt
  4. Windows: Look in the Anaconda3 group in the Start Menu and click on the Anaconda Prompt icon. Alternatively, launch Anaconda Navigator and click on the CMD.exe Prompt tile.

    Mac: Open a normal terminal window. An easy way is use Spotlight to search for "term".

  5. Install geopandas from the conda-forge channel
  6. Give the command:

    conda install geopandas -c conda-forge

    Note that there is one dash before the "c". This will install the latest version of geopandas from Anaconda's "conda-forge" channel, which contains the most recent versions of optional packages.

    You'll see a message about solving the environment and there will be a long pause that may last for ten minutes or more. It will look like the process has frozen but it's actually still working. After it finishes, it should produce a bunch of new messages about changes that will be made, followed by a "Proceed?" prompt. Hit enter. There will be yet another raft of messages about changes.

    It many be useful to know that the length of time the "solving" step takes differs a lot from one machine to another: it depends on your operating system, the speed of your computer, and the amounts of RAM and disk space you have. It might be a good time to take a break and do something else while it's running. If you want to make sure your computer hasn't hung, you can check using Task Manager on Windows or Activity Manager on a Mac and you should see a Python process using a lot of memory and a fair amount of CPU time.

    If conda finds inconsistencies in your configuration that it can't fix, instead of a Proceed? prompt you'll see a message (possibly many lines long) explaining where it found the inconsistency. If that happens, send me a note and we'll set up a meeting to fix it.

  7. Check the installation
  8. To make sure everything worked, give the command below at the command line:

    conda list geopandas

    If all has gone well, it should list geopandas and geopandas-base and both should be the version 0.14.2 or later.

    If that looks OK, start spyder and run the demo script from the Geopandas assignment repository. If all goes well, it should draw a plot of the boundary of Syracuse.

  9. If something goes wrong
  10. If geopandas didn't install cleanly and your symptoms don't match anything in the list below (or if you're not sure), send me a message on Slack to let me know what happened and I'll help you get it sorted out. Resist the temptation to Google for solutions unless you're really familiar with Anaconda. There's a lot of bad advice out there, and in the past it has often led people to make things worse.

Fixes and Workarounds

Geopandas depends on a lot of other modules and sometimes things get out of sync when installing it. Here are solutions to a few things that sometimes come up.

  • File access errors when writing files from Python after installing geopandas
  • Make sure your antivirus scanner isn't blocking Python. Some virus scanners block very new executables by default.

  • Spyder won't start due to missing python.app on a Mac
  • conda install --force-reinstall python.app
  • Older problems that are unlikely to arise
  • Here just in case they're ever relevant.
Site Index | Zoom | Admin
URL: https://wilcoxen.maxwell.insightworks.com/pages/6373.html
Peter J Wilcoxen, The Maxwell School, Syracuse University
Revised 03/27/2024