When extending ArcGIS Python functionality (e.g., using openpyxl for Excel integration), installing supplementary packages becomes necessary. This guide demonstrates manual and automated installation methods for both online and offline scenarios.
Manual Installation
Suitable for offline environments, manual installation requires addressing these prerequisites:
1. Verify Python Environment Variables
Ensure ArcGIS Python paths are configured in system variables:
- Navigate to:
Control Panel → System → Advanced system settings → Environment Variables
!https://image.malagis.com/gis/2024/20240605095333.png - Edit
Path
under System Variables:
!https://image.malagis.com/gis/2024/20240605095359.png Add these critical paths (Example for ArcGIS 10.2):
C:\Python27\ArcGIS10.2 # For python.exe C:\Python27\ArcGIS10.2\Scripts # For package executables
Validate in Command Prompt:
python --version
2. Package Acquisition
Download compatible packages from PyPI: https://pypi.org/
Version Selection Guidelines:
- For Python 2.7 (ArcGIS 10.x), use openpyxl 2.6.2
- Prefer
*.tar.gz
format for older Python versions - Download sequence:
3. Installation Procedure
- Extract the downloaded package
- Open command prompt at the
setup.py
directory Execute:
python setup.py install
Dependency Note: openpyxl requires et_xmlfile and jdcal. Resolve dependency errors by installing these first.
Automated Installation
Online Method
With internet access, use pip:
pip install openpyxl
Version Considerations:
- ArcGIS 10.x: Upgrade pip first (
python -m pip install --upgrade pip
) - ArcGIS Pro: Pre-installed packages visible at:
ArcGIS Pro → Settings → Python
PyCharm Integration
Attempt import:
import openpyxl
- Click installation prompt when error appears:
- Alternatively use package manager:
File → Settings → Project → Python Interpreter → +