Importing ArcPy Crashes Python Interpreter

963
7
Jump to solution
09-19-2019 09:17 AM
NathanHeickLACSD
Occasional Contributor III

I am getting the following error when trying to import arcpy or arcgis from a stand-alone Python script either run from IDLE for Python 3 or through the Conda Python interpreter that comes with ArcGIS Pro:

Faulting application name: pythonw.exe, version: 3.6.8150.1013, time stamp: 0x5c6f5f72

Faulting module name: GpPythonCore.dll, version: 12.4.0.19948, time stamp: 0x5d0ad153

Exception code: 0xc0000005

Fault offset: 0x000000000000a4ad

Faulting process id: 0x4ce0

Faulting application start time: 0x01d56e6b54efb586

Faulting application path: C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\pythonw.exe

Faulting module path: C:\Program Files\ArcGIS\Pro\bin\GpPythonCore.dll

Report Id: 5f5e420e-e05b-48d1-9985-a969e646b5b3

Faulting package full name:

Faulting package-relative application ID:

Everything was fine up until the following occurred.  I was trying to use Pandas data frames in a stand-alone Python script.  I was writing the script in Wing IDE, but I had not figured out how to set up the Wing project to use Python 3.  Therefore, I was opening the script up in IDLE to run it. I was in the process of switching from using NumPy arrays and Pandas data frames to using spatially-enabled data frames.  I added the imports to use SEDFs and I had some sort of error.  I decided it was time to setup my Wing project to point to Python 3 instead of 2.  I did research online and I believe I copied the path to the root environment Python interpreter and pasted it into the settings in Wing.  After that, when I went to run it, python.exe crashes.  It crashes from Wing, IDLE, and the command prompt.  It does not, however, crash from the root python command line or ArcGIS Pro.  I isolated the problem down to the import statement and I am just typing in import arcpy or import ArcGIS from the Python command line.

I tried to reinstall ArcGIS Pro, then both ArcMap and ArcGIS Pro, and neither worked.  I uninstalled Wing IDE and I am only trying to get basic ArcGIS Pro functionality to work.

I am hoping someone has some insight.

0 Kudos
1 Solution

Accepted Solutions
NathanHeickLACSD
Occasional Contributor III

Yes.  I couldn't even replicate the issue after reimaging my machine and doing what I thought might have caused the problem.  I could not replicate it on someone else's machine either.  It was one of the weirdest problems I have come across.

View solution in original post

0 Kudos
7 Replies
Arne_Gelfert
Regular Contributor

Nathan, sorry to hear about your issues. Sounds like you're getting wires crossed with your Python versions. That's been driving me crazy in the ESRI world for some time. Different Python releases, different versions of arcpy between ArcMap and Pro. Gets confusing. All I can suggest is uninstalling all your Python versions and taking good notes of any changes.

Do you have multiple environments set up in...

C:\Program Files\ArcGIS\Pro\bin\Python\envs? 

Sometimes, changing environments or creating a new ones has helped me out of pinch.

# list environments in conda

conda env list

#switch environmente

conda activate <my-environment>

Some helpful documenation: Managing environments — conda 4.7.12.post21+f620e4da documentation 

0 Kudos
NathanHeickLACSD
Occasional Contributor III

No, I only have the default environment.  The problem goes away if I revert back to ArcGIS Pro 2.3 from 2.4.  Then, it comes back when I upgrade again.

0 Kudos
DanPatterson_Retired
MVP Esteemed Contributor

You don't mention whether you are using ArcMap as well... I am assuming you don't

one option:

If you are only using the default environment,

remove 2.3, including addins

uninstall pro 2.3 using windows add/remove

rename any 'esri' folders in your c:\user... file path to 'esriold

install 2.4

while you are at it, remove any python installations that you have

another option:

remove wing and reinstall it so it gets the correct python

0 Kudos
NathanHeickLACSD
Occasional Contributor III

Yes, I do have ArcMap as well.  I spent 3-4 days working with Esri on this issue and I then I decided that it would be faster just to reimage my machine.  I tried all of those things and others in various orders and nothing would work.  We uninstalled ArcMap, Wing, and removed all Esri registry entries.  There was something somewhere that we could not find.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

Is it working after reimaging?

0 Kudos
NathanHeickLACSD
Occasional Contributor III

Yes.  I couldn't even replicate the issue after reimaging my machine and doing what I thought might have caused the problem.  I could not replicate it on someone else's machine either.  It was one of the weirdest problems I have come across.

0 Kudos
JoshuaBixby
MVP Esteemed Contributor

I marked this question as "assumed answer" since there really isn't anything anyone can do at this point to resolve an issue that isn't reproducible.

0 Kudos