In ArcMap, I open the Python window and print some codes as followed:

import arcpy
arcpy.env.workspace = "C:/data"
                              "ROUTE1", "MEASURE")

Runtime error Traceback (most recent call last):

File "", line 1, in

File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy__init__.py", line 21, in from arcpy.geoprocessing import gp

File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\geoprocessing__init__.py", line 14, in from _base import *

File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\geoprocessing_base.py", line 598, in env = GPEnvironments(gp)

File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\geoprocessing_base.py", line 595, in GPEnvironments return GPEnvironment(geoprocessor)

File "c:\program files (x86)\arcgis\desktop10.3\arcpy\arcpy\geoprocessing_base.py", line 548, in init import weakref

File "C:\Users\yanglan\Anaconda2\Lib\weakref.py", line 14, in from _weakref import ( ImportError: cannot import name _remove_dead_weakref

i want to know whether this error has a correlation with the anaconda2 installed in my computer, so curious about how to fix this problem

  • Welcome to GIS SE! As a new user be sure to take the Tour. Please always provide code and any error messages as text rather than pictures. There is an edit button beneath your question which will enable you to do that and a {} button that enables you to format any highlighted code nicely. – PolyGeo Apr 24 '18 at 4:09
  • 1
    Wow, that is quite an error.. unfortunately it has to do with a module called weakref and not arcpy. You could edit c:\program files\arcgis\desktop10.3\arcpy\arcpy\geoprocessing\_base.py and comment out line 548, be sure to remove the _base.pyc if it exists, as it sounds like weakref is no longer installed. If you're not comfortable with that then reinstall ArcGIS but there's no guarantee Anaconda will work afterwards. – Michael Stimson Apr 24 '18 at 4:20
  • i open c:\program files\arcgis\desktop10.3\arcpy\arcpy\geoprocessing_base.py and line 548 shows "import weakref". there is a warn "'weakref' imported but unused" in this line. should i delete this line? – Yanglan Wang Apr 24 '18 at 4:54
  • Why delete when you can comment out to test it. – PolyGeo Apr 24 '18 at 6:15
  • i found the reason. the anaconda infects the run of arcgis. if upinstall the anaconda, the arcgis can show the correct result. so do you know how to run the arcgis insulating anaconda – Yanglan Wang Apr 24 '18 at 7:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.