Installing Python Toolboxes
Installing Python Toolboxes
This is a guide to installing custom Python packages that include Python Toolboxes. This guide is meant for packages built with the folder structure described in Extending geoprocessing through Python modules.
This guide uses pip to install Python packages. The pip command retrieves packages from the Python Package Index, pypi.org.
Installing a package
To install the wsdottraffic
package for the current user, use the following command. When installing a different package, use that package name instead of wsdottraffic
.
pip install wsdottraffic --user
To install the package for all users, simply omit the --user
argument from the above command.
Adding additional package hosting site
By default, pip will only search pypi.org for packages. Once the steps below have been completed, you will be able to use the pip install
command to install packages for sites other than pypi.org. (See Hosting your own simple repository for details on how to set up your own repository.)
- Open the
%allusersprofile%
folder, then open thepip
subfolder, or create it if it does not already exist. -
Open the
pip.ini
file in a text editor, first creating the file if it does not already exist.If the
pip.ini
file does not exist, you can create it with the following PowerShell command. This command will also generate the parentpip
folder if necessary.New-Item "$env:ALLUSERSPROFILE\pip\pip.ini" -Force
-
Add the following to the
pip.ini
fileReplace the example URL with your own.
[global] extra-index-url = https://example.com/PythonPackages/
If you try to install a package from the URL and receive error messages related to HTTPS, you can work around this issue by configuring the site to be a “trusted host”:
[global] extra-index-url = https://example.com/PythonPackages/ trusted-host = example.com
Locating Python Toolboxes
This section will tell you where to find Python toolboxes that have been installed as part of a package installed with pip.
Per-user installs
You can list all of the Python Toolboxes installed for the current user account with the following PowerShell command.
Get-ChildItem $env:appdata\Python\**\*.pyt -Recurse | Select-Object -ExpandProperty FullName
For packages installed via Conda instead of pip.
Get-ChildItem "$env:LOCALAPPDATA\ESRI\conda\**\*.pyt" -Recurse
For all users installs
ArcGIS Desktop
Get-ChildItem "$env:SystemDrive\Python*\ArcGIS*\Lib\site-packages\**\*.pyt" -Recurse