archook searches a Windows machine for ArcGIS and updates the active Python
process so arcpy can be imported from a Python installation that ArcGIS did
not manage directly.
If ArcGIS is not found, archook raises ImportError.
Use pro=True to target ArcGIS Pro instead of ArcGIS Desktop.
try:
import archook
archook.get_arcpy()
import arcpy
except ImportError:
passtry:
import archook
archook.get_arcpy(pro=True)
import arcpy
except ImportError:
passInstall the published package with pip:
pip install archookInstall directly from GitHub:
pip install https://github.com/JamesRamm/archook/archive/refs/heads/master.zipRequires Python 3.10 or later.
Create the project environment and install the dev tools with uv:
uv sync --group devRun the test suite:
uv run pytest -qBuild source and wheel distributions:
uv buildArcGIS Pro may require a conda-meta directory under the active interpreter's
sys.prefix. If arcpy reports that it must run inside an active ArcGIS conda
environment, create that directory and retry.
Archook was developed by James Ramm, currently maintained by Matt Wilkie.