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

Python used to be installed at the root of the "C" drive on MS-Windows computers but now it should be installed in "Program Files". If you just installed it for your use, it will be in your "users" folder. Inside "Program Files", you should see one or more versions of "PythonX" where the "X" is the version. If you go into this folder and then into "Lib/site-packages", you'll see folders from the packages (a.k.a. libraries) that have been installed in that version of Python.

If you go into the ArcGIS version of Python, you'll see the libraries they have installed. My my computer the folder for packages is at the path below but note that Esri is in control of this and it may change at any time. Also, we have tried to add packages to this install of Python in the past and failed. Let me know if you find a way.

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib\site-packages

The old ArcMap packages for Python at: "C:\Python27\ArcGIS10.2\Lib\site-packages" ArcMap has very limited external library support!

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 or library 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 X.X could not be found in the registry".

Note: The standard install for ArcMap is a 32-bit version of Python!

Easy Install and pip

For many year, pip had serious problems so they came up with a range of different solutions, none of which worked well. Fortunately, someone fixed pip and it is now how I install almost all of my libraries for Python. pip is a program in the "scripts" folder of the Python install. To use pip, open a command line window (you may need to right click and open it as an administrator), use "cd" to move into the "scripts" directory, and then type the following where "NameOfPackage" is the name of the package you want to install.

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. I used to use it but now that pip is working, I have not used it in years. You run easy_install 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.

Anaconda

Anaconda appeared to work well for Python 3.x but we found it failed to install some required packages on MS-Windows. Because of this, we are not using it. There are other attempts to fix this with something called "conda" and even "mini-conda" but I don't recommend any of these.

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.

Unofficial Package Installers

When all else fails, you may need to use the wheel files from Christoph Gohlke’s GitHub site. This is how we install GDAL which also installs OGR and OSR. There are instructions for using Christoph's website in the "Getting Started" web page of the SpaPy website.

Christoph Gohlke’s GitHub site

© Copyright 2018 HSU - All rights reserved.