Peter J Wilcoxen > PAI 789 Advanced Policy Analysis

Installing Geopandas

The 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: probably 10-15 minutes. If anything goes wrong, let me know and we'll set up a Zoom call to get things straightened out.

  1. Open an Anaconda command line prompt
  2. 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.

  3. Update the existing Anaconda installation
  4. At the command line, give the command conda update --all to update Python and all of its modules to the latest versions. Note that there are two dashes before the word "all". After a few moments there will be a long list of messages about changes that will be made. It will end with a prompt that says something like "Proceed ([y]|n)?" Hit enter to start the changes. There will be another long raft of messages about updates being made and it will take a few minutes to finish.

  5. Install geopandas
  6. Next, give the command conda install geopandas=0.8.1. There will be several messages about "solving environment" and some of them will say that a step failed. However, those are warnings rather than fatal errors: let the process keep going. After several minutes, it should produce a bunch of new messages about changes that will be made, followed by another "Proceed?" prompt. Hit enter. There will be yet another raft of messages about changes. Mac users: if the update process doesn't find anything and ends without the "Proceed?" prompt, try the installation without the version number: conda install geopandas.

    The "solving environment" step checks for prerequisite modules needed by geopandas so that any missing ones can be installed with it. Because geopandas has a lot of prerequisites, and they themselves have prerequisites, and the overall Anaconda distribution has many, many modules, the search process can take more time than you'd expect: maybe 5 minutes or more. However, it also sometimes gets stuck and doesn't finish. If it is still running after 10 minutes, it's OK to stop it. Let me know if that happens and we can set up a Zoom call to try some additional steps.

  7. Start spyder to check the installation
  8. To make sure everything worked, start spyder and enter "import geopandas" in the console window. If all has gone well, it should quietly succeed with no error or warning. If that's the case, you're done . If you get an error instead, send me a message to set up a Zoom session to sort things out.

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.

  • Error when importing geopandas due to not finding lib c
  • pip install --upgrade --force-reinstall shapely
  • Geopandas is installed but out of date
  • conda install geopandas=0.8.1 -c conda-forge
  • Plotting in Spyder 4 produces an error message about qdarkpalette
  • conda install spyder=4.2.5
  • Spyder 4 window is scrambled after switching to Spyder 5 and then back to Spyder 4
  • Delete folder .spyder-py3 in your home directory and restart Spyder.

  • Spyder 5 produces a warning about the version number of spyder-kernels
  • conda install spyder=5.0.1
  • Spyder won't start due to missing on a Mac
  • conda install --force-reinstall
Site Index | Zoom | Admin
Peter J Wilcoxen, The Maxwell School, Syracuse University
Revised 06/08/2021