Select to view content in your preferred language

Arcpy Pro crash when using memory or in_memory

1471
12
Jump to solution
02-28-2023 03:31 PM
HarrySmiles
New Contributor III
I updated from ArcGIS Pro 3.0.3 to 3.1 yesterday, and since then any time I try to write anything into "memory" or "in_memory" it causes ArcGIS Pro to crash. 
HarrySmiles_0-1677626972532.png

 

This is an example of some code, but everything I have tried with memory or in_memory causes the same issue.  
arcpy.MakeFeatureLayer_management(input_locations, input_location_layer, f"{input_name_field} = '{location}'")
arcpy.CopyFeatures_management(input_location_layer, f"memory\\{location}_facility")
 
 
I have tried doing a full uninstall (including deleting all the Pro folders and registry entries), and I've also tried creating a new Python Environment but get the same issue. 
 
Any ideas?
1 Solution

Accepted Solutions
HarrySmiles
New Contributor III

After some advise I tried another uninstall and full folder wipe, then reinstalled and it seems to have fixed the issue. I'm not sure what changed as I had done that, but I'm back up and running now.

Thanks

View solution in original post

12 Replies
DanPatterson
MVP Esteemed Contributor

to test, skip the substitution and use the actual field names and locations

eg dump,  f"{input_name_field} = '{location}'") and this f"memory\\{location}_facility"


... sort of retired...
0 Kudos
HarrySmiles
New Contributor III

I tried running the code in a notebook outside of the loop with everything hard coded and get the same issue unfortunately.

 
arcpy.MakeFeatureLayer_management(input_locations, 'location_layer_CRAN', "code = 'CRAN'")
 
arcpy.CopyFeatures_management('location_layer_CRAN', "memory\\CRAN_facility")
 
 
I don't know enough about the how the memory or in_memory workspaces work to debug this but I'm now confident they are the issue. I created a tempory filegeodatabase and used that instead of memory and it works.
 
arcpy.MakeFeatureLayer_management(input_locations, 'location_layer_CRAN', "code = 'CRAN'")
arcpy.CopyFeatures_management('location_layer_CRAN', "c:\\aaa\\temp.gdb\\CRAN_facility")
0 Kudos
by Anonymous User
Not applicable

Try adding a '\' to the memory: "\\memory\\CRAN_facility"

There is another thread on here that memory\\ fails, but \memory\\ works. I'll try to link it for reference.

Edit- Here is the thread.

0 Kudos
HarrySmiles
New Contributor III

Thanks for the reply, but unfortunatley I now get this error:

ERROR 000210: Cannot create output \memory\CRAN_facility

That is using.

arcpy.CopyFeatures_management('location_layer_CRAN', "\\memory\\CRAN_facility")
or
arcpy.CopyFeatures_management('location_layer_CRAN', "\memory\\CRAN_facility")
0 Kudos
by Anonymous User
Not applicable

Man, that is troublesome! How about os.path.join('memory', 'CRAN_facility')?

0 Kudos
by Anonymous User
Not applicable

Try adding the r decorator to the string. These two worked for me, but the "memory\\CRAN_facility" gave me the error that you received.

arcpy.CopyFeatures_management(fc, r"memory\CRAN_facility")
arcpy.CopyFeatures_management(fc, os.path.join("memory", "CRAN_facility2"))

 

HarrySmiles
New Contributor III

Same thing I'm afraid. I don't know enough about the underlying mechanism of the memory or in_memory workspaces, but I have a feeling that something has either moved with the upgrade or something got corrupted. 

That said I kind of assumed that a full reinstall would have fixed the issue and it didn't.

I have tried running the code on a colleges computer and it worked on that one, which was also updated Pro to 3.1 yesterday. That tells me it isn't a code issue but an Arcpy or Python issue.

I have also tried cloning the environment but I get the same issue with the clone.

0 Kudos
ShaunWalbridge
Esri Regular Contributor

Have you submitted the crash dumps? If you send one to me, I can take a quick look to see if it's anything obvious. Are you using the default `arcgispro-py3` environment, or a custom environment?

0 Kudos
HarrySmiles
New Contributor III

Thanks Shaun.

Our work firewall seems to block sending the dump but here is one.

That was using the default environment, but I have also cloned it and get the same. I did try to create a new environment using conda, then installed the arcpy package. When I try to import arcpy using that environment I got the below error so I gave up on that.

ImportError: DLL load failed while importing _arcgisscripting: The specified module could not be found.

0 Kudos