GIS Logo GSP 118 (318): GIS Programming

Other Packages/Libraries

1. The Python Standard Library

There are a large number of libraries that are included with Python. They are listed at

The Python Standard Library

2. Where External Libraries are Installed

Take a look in the folder at: "C:\Python26\ArcGIS10.0\Lib\site-packages" and you'll see folders for the external packages that we've installed for use in this class.

Note: Libraries have to be installed for each version of Python you have on your computer and if you upgrade to a new version, you'll need to reinstall all your libraries.

3. Bindings

When an existing program is linked to Python, the developers will usually call this providing "bindings for Python". This just means that they have provided a link between Python and the program that you can use by "importing" the library. "arcpy" is the name of the binding between Python and ArcGIS.

4. External Packages

We've already seen NumPy and MatPlotLib. The good news is that there are a large number of packages for Python. The bad news is that not all of them install as an extension to Python (some, like FWTools come with their own version of Python) and they vary greatly in the quality of their documentation and implementation. Plan on spending some quality time getting to know each package before you commit to using it in a project.

Lists of packages are available at:

5. Installing Packages

There is a lot of confusion over how to install packages, especially on the Python.org web site. The good news is that most of the packages provide an installer for various versions of Python and various operating systems. In other cases, you can download the package, unzip it, and then run a "setup.py" script from the command line.

Note: The standard install for ArcGIS will put a copy of Python into a sub folder of the python directory (i.e. C:/Python26/ArcGIS10.1/). This is a 32-bit version of Python! So, to install packages that you want to use with scripts that also work with ArcGIS, you'll need to install 32-bit versions of the packages. Otherwise, you'll receive an error that "Python 2.7 could not be found in the registry".

 

Unofficial Package Installers

My favorite approach to installing packages is to go to:

http://www.lfd.uci.edu/~gohlke/pythonlibs/

Where you'll find MS-Windows installers for most of the packages you'll ever need.

 

Easy Install

Easy install is referenced as an easy method to install many packages. However, to use "easy_install", you need to install Setuptools from the Python web site. Installing setup tools can be problematic and you'll want to follow the instructions closely. Also, make sure you run it from with the version of Python (i.e. the python.exe file) into which you want to install the packages.

Note: Do not run the setup for Setuptools in Wing IDE. For some unknown reason it takes forever. You'll need to run it in the command prompt.

When done, you will have an executable file "easy_install.exe" in the "Scripts" folder of your Python folder. Now, you can run this program to install most packages.