I'm starting to develop som geoprocessing tools in ArcGIS Pro using some third party python modules, but even with the simpliest of tools it fails to run from Portal
import arcpy import openpyxl class Toolbox(object): def __init__(self): """Define the toolbox (the name of the toolbox is the name of the .pyt file).""" self.label = "Toolbox" self.alias = "" # List of tool classes associated with this toolbox self.tools = [Tool] class Tool(object): def __init__(self): """Define the tool (tool name is the name of the class).""" self.label = "Tool" self.description = "" self.canRunInBackground = False def getParameterInfo(self): """Define parameter definitions""" param0 = arcpy.Parameter( displayName="Input Features", name="in_features", datatype="GPString", parameterType="Required", direction="Input") param0.filter.type = "ValueList" param0.filter.list = ['test1','test2'] param1 = arcpy.Parameter( displayName="Label", name = "LabelTest", datatype="GPString", parameterType="Optional", direction="Input" ) params = [param0, param1] return params def isLicensed(self): """Set whether tool is licensed to execute.""" return True def updateParameters(self, parameters): """Modify the values and properties of parameters before internal validation is performed. This method is called whenever a parameter has been changed.""" parameters.value = parameters.value return def updateMessages(self, parameters): """Modify the messages created by internal validation for each tool parameter. This method is called after internal validation.""" return def execute(self, parameters, messages): """The source code of the tool.""" returnVal = parameters.value + ' TEST ' + parameters.value arcpy.AddWarning(returnVal) return
If I run this from Pro theres no problem and I can publish it as a webtool, no problem
But when I want to run it from portal i fails, unless I publis it without the import openpyxl line
So how do I get portal to use third party python modules like openpyxl ?
I know that, but how do I install those modules on the server, and witch server ?
My configuration is
Now that I'm developing in Python 3.x I would like for the server to run Python 3.x so I don't have any trouble with unicode characters ect.
re: getting installed on the Server....have you tried installing Pro on the server? I would think that would get Python 3 the environment setup with the correct paths, etc., but Dan is much more knowledgeable about that than I am, so I'll defer to him/others.