Select to view content in your preferred language

in_memory\ for geoprocessing in ArcGis Pro?

8384
15
10-08-2019 10:27 AM
LynnGaines
Occasional Contributor

In Arc Pro 2.6, the message ERROR 000210: Cannot create output memory\example is returned after I run my geoprocessing script.  The script is using Python 3.6.  

I understand that Arc PRO is different from ArcMap in that it is 64-bit and does not block the application while a tool is running.  I read, however, that the mulithreaded approach writes on-disk in PRO when using "in_memory\\example " and not to memory as I prefer.   Using "memory\example", seemed to be the solution, but then it results in the error mentioned above.

Can you please help me in identifying a way to write to memory as I did in ArcMap with the goal of publishing? Below is a bit of the code that I used.  Any help is appreciated.  

 

#Import arcpy modules

from arcpy import MakeQueryLayer_management
from arcpy import CopyFeatures_management
from arcpy import env

#Local Variables

LPRMQ = r"memory\LPRMQ"

#Input/Output

PIDNum = arcpy.GetParameterAsText(0)

arcpy.SetParameterAsText(1, r"memory\LPR")

#  Set Geoprocessing environments

arcpy.env.scratchWorkspace = "C:\\Users\\..."

arcpy.env.workspace = "C:\\Users\\..."

arcpy.MakeQueryLayer_management(DB, LPRMQ, "SELECT ...")

arcpy.CopyFeatures_management(LPRMQ, r"memory\LPR", "", "0", "0", "0")

Lynn

0 Kudos
15 Replies
JoshuaBixby
MVP Esteemed Contributor

The original in-memory workspace, i.e., "in_memory", is actually only in memory when run out of process, not when run within the ArcGIS Pro application.  The Considerations when using the in_memory workspace—Appendices | Documentation covers this topic.

If you want intermediate data sets to be in actual memory while using the ArcGIS Pro application, you need to use the newer in-memory workspace, i.e., "memory".  Just be aware, older ArcPy tools that require the workspace to be set using arcpy.env.workspace don't support either in-memory workspace with ArcGIS Pro.

Regarding advanced ArcGIS users, there are quite a few on GeoNet, including ones that do beta testing on versions of ArcGIS Pro that hasn't been released yet.  That said, it doesn't take an advanced user to read the documentation.

deleted-user-3K8mKpoPb261
Deactivated User

Thanks but I've actually read that documentation and already tried the new 'memory' workspace but as I mentioned above the issue wasn't solved until I downgraded to ArcGIS Pro 2.4

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

The problem for GeoNet readers is that you said you are having the same issue as the OP, but the code snippet you provided focused on a different issue than the OP's issue.  If you want to provide more code, the error and trackback with Pro 2.5, then people can provide more specific feedback.

James_Whitacre
Frequent Contributor

Reviving this conversation...

I just had an issue where I was using:

temp_features = r'in_memory\Features_Temp'


Then I was updating code for ArcGIS Pro and changed it to:

temp_features = r'memory\Features_Temp'


The temp_features are being run through Viewshed 2 Tool. When run using 'in_memory\', everything works as expected. But when run through 'memory\', the tool fails with an '010471: No observers found in analysis extent.' error.

Any ideas why this may be? Thanks.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

What version of Pro are you using?  Prior to Pro 2.5, the memory workspace did not support any kind of raster dataset. 

0 Kudos
James_Whitacre
Frequent Contributor

@JoshuaBixby I am working with ArcGIS Pro 2.7, and I am not working with raster datasets in the memory space in this case. The 'temp_feature' variable is a feature class that is the input points for the Viewshed 2 tool.

0 Kudos