Masthead

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

On the lab computers, navigate to the "pkgs" folder within your Python folder (typically C:\Program Files\Anaconda3) to see all the libraries, or "packages", that Anaconda has installed for us. Anaconda appears to work well for managing almost all the libraries we need in class and that I have used on projects. However, there are a number of other methods to install packages that we'll talk about in a bit.

Take a look in the folder at: "C:\Python27\ArcGIS10.2\Lib\site-packages" and you'll see folders for the external packages that are available in the ArcMap 10 install of Python. ArcMap has very limited external library support and ArcGIS Pro is worse!

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

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:

You can also add additional "external" libraries to Python. The information below will help you install libraries on your work or personal computer. The libraries we have available on the vlab and lab computers include:

You can see the full list by executing the Python function: help("modules") or running "pip list" from the command line while in the Python "scripts" folder.

5. Installing Packages

There is a lot of confusion over how to install packages, especially on the Python.org web site. There are also a large number of options for installing packages.

Note: We cannot install additional packages on the computers in the labs but this information will be important in the future and potentially

Note that we are using Python 3.x 64-bit. There are also old 32-bit versions of Python. If you use 64-bit Python you have to use libraries that are built for 64-bit Python. Similarly, if you use 32-bit Python, you have to use 32-bit versions of the libraries. Otherwise, you'll receive an error that "Python 2.7 could not be found in the registry".

Note: The standard install for ArcGIS will put a copy of Python into a sub folder of the python directory (i.e. C:/Python27/ArcGIS10.1/). This is a 32-bit version of Python!

Anaconda

Anaconda appeared to work well for Python 3.x but we found it failed to install some required packages on MS-Windows.

Provided Installers

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.

Easy Install and pip

pip is one of the most popular ways to install packages. pip is a program in the "scripts" folder of the Python install and packages can be installed with:

pip install NameOfPackage 

easy_install is another installation program and is referenced as an easy method to install many packages. east_install used to be provided in another package but it is now part of the standard Python installation. You run it from inside the scripts folder with:

easy_install NameOfPackage  

Also, make sure you run pip or easy_install from the version of Python (i.e. the python.exe file) into which you want to install the packages.

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.

© Copyright 2018 HSU - All rights reserved.