I need to publish a geoprocessing tool as a service using ArcGIS Pro. This tool requires a Python library called 'xlsxwriter', so I created a new Python environment (by cloning the default). I successfully activated the Python environment in my .aprx project, then ran the custom geoprocessing tool. The tool fails to run because it tries using the default Python interpreter, so the package is missing.
Also it appears after activating to the desired Python environment (not default), this option never actually saves in the .aprx file. I activate it, save and restart - the chosen environment always reverts to default.
I have also tried editing the Geoprocessing options' script editor to the new environment's python.exe. That also fails to run the tool using the correct environment
How can I force Pro to run the project using the desired Python environment? I can't publish the service until the tool runs successfully in Pro. I am using Pro version 2.8.1
Solved! Go to Solution.
you could package it with your tools, it isn't very big
jmcnamara/XlsxWriter: A Python module for creating Excel XLSX files. (github.com)
the package doesn't need to be in the environment, just accessible from the script that imports it
Create geoprocessing modules—ArcGIS Pro | Documentation
you could package it with your tools, it isn't very big
jmcnamara/XlsxWriter: A Python module for creating Excel XLSX files. (github.com)
the package doesn't need to be in the environment, just accessible from the script that imports it
Create geoprocessing modules—ArcGIS Pro | Documentation
Thanks. I hadn't considered just importing it within the script itself.