-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Describe the bug
The standard from arcgis.features import GeoAccessor, GeoSeriesAccessor calls for spatially-enabled dataframes are throwing ImportErrors when run on python 3.13 in environments that don't have setuptools installed.
This is breaking our CI pipelines in GitHub Actions that use docker containers to run our unit tests: https://github.com/agrc/palletjack/actions/runs/20241324680/job/58109950144?pr=172
This seems to be related to the deprecation of distutils per https://stackoverflow.com/a/79468048
This only started occurring when we switched our package's base python from 3.11 to 3.13 (in line with the latest ArcGIS Pro release).
To Reproduce
Locally on Windows w/conda:
- Create new conda env
conda install python=3.13 -c defaults- conda installs setuptools automatically, so uninstall it:
pip uninstall setuptools pip install arcgis- Open the REPL,
from arcgis.features import GeoAccessor
In GitHub Actions:
runs-on: ubuntu-latest- Checkout code:
actions/checkout@v5 - Setup python:
actions/setup-python@v6 - Install deps:
run: sudo apt-get update && sudo apt-get install -y libkrb5-dev - Install module:
run: pip install .[tests] - Run Pytest:
run: pytest
error:
Local:
Traceback (most recent call last):
File "<python-input-1>", line 1, in <module>
from arcgis.features import GeoAccessor
ImportError: cannot import name 'GeoAccessor' from 'arcgis.features' (C:\Users\<user>\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\test\Lib\site-packages\arcgis\features\__init__.py)GitHub Actions:
_____________________ ERROR collecting tests/test_utils.py _____________________
ImportError while importing test module '/home/runner/work/palletjack/palletjack/tests/test_utils.py'.
Hint: make sure your test modules/packages have valid Python names.
Traceback:
/opt/hostedtoolcache/Python/3.13.11/x64/lib/python3.13/importlib/__init__.py:88: in import_module
return _bootstrap._gcd_import(name[level:], package, level)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
tests/test_utils.py:15: in <module>
import palletjack
/opt/hostedtoolcache/Python/3.13.11/x64/lib/python3.13/site-packages/palletjack/__init__.py:8: in <module>
from . import extract, load, transform, utils # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
/opt/hostedtoolcache/Python/3.13.11/x64/lib/python3.13/site-packages/palletjack/load.py:17: in <module>
from arcgis.features import GeoAccessor, GeoSeriesAccessor # noqa: F401
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
E ImportError: cannot import name 'GeoAccessor' from 'arcgis.features' (/opt/hostedtoolcache/Python/3.13.11/x64/lib/python3.13/site-packages/arcgis/features/__init__.py)
Expected behavior
Import call to sueceed.
Platform (please complete the following information):
- OS: Local: Windows 11. GitHub Actions: ubuntu-latest (24.04, I believe)
- Browser : NA
- Python API Version: 2.4.2
Additional context
The standard conda install python grabs setuptools so this isn't apparent until you try to run code on something that doesn't install setuptools by default, like our CI pipeline.
Adding setuptools to our requirements in setup.py fixes the imports and allows our unit tests to collect and run as expected.