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.

5. Update the existing Anaconda installation
6. At the command line, give the command:

conda update --all -c conda-forge

That will update Python and all of its modules to the latest versions on the conda-forge channel. 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. Don't worry if it says some packages will be downgraded: that's normal and not a problem. The message 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.

7. Install geopandas
8. Next, give the command:

conda install geopandas=0.10.2 -c conda-forge

There will be several messages about "solving environment" and some of them may 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.

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: sometimes as long as 30 minutes or more. However, it also sometimes gets stuck and doesn't finish. If it is still running after 30 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.

9. Start spyder to check the installation
10. 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.

11. If something goes wrong
12. 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. Try to resist the temptation to Google for solutions unless you're really familiar with Anaconda: in the past that has 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.

• Error when geopandas imports the fiona module and can't find libpoppler
• conda install poppler=21.09.0 -c conda-forge
• Error when importing geopandas due to not finding lib c
• pip install --upgrade --force-reinstall shapely
• 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.

• Geopandas is installed but out of date
• conda install geopandas=0.10.2 -c conda-forge
• Plotting in Spyder 4 produces an error message about qdarkpalette
• conda install spyder=4.2.5 -c conda-forge
• 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 won't start due to missing python.app on a Mac
• conda install --force-reinstall python.app
URL: https://wilcoxen.maxwell.insightworks.com/pages/6373.html
Peter J Wilcoxen, The Maxwell School, Syracuse University
Revised 04/08/2022