I am getting the following error when running my python scripts in Pycharm, does anybody know how to fix it? it is very odd, because it was working just fine, then installed some updates on ArcGIS Pro and did not work anymore.

C:\Users\C5LB\AppData\Local\ESRI\conda\envs\arcgispro-py3-clone5\python.exe C:/C5LB/Overlay_Scriptool/OverlayManyTables.py
arcpy must be run from inside the Conda environment, which ArcGIS
uses to manage the installation of Python.
You can access this environment by launching Python from the links inside the
"ArcGIS > ArcGIS Pro" Start Menu Group:
    "Python Interactive Terminal" starts a Python session.
    "Python Command Prompt" opens a Command Prompt window initialized with Conda.

Or by running the proenv.bat file in the terminal:
C:\> C:\Program Files\ArcGIS\Pro\bin\python\scripts\proenv.bat

Traceback (most recent call last):
  File "C:/C5LB/Overlay_Scriptool/OverlayManyTables.py", line 4, in <module>
    import arcpy
  File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\__init__.py", line 68, in <module>
    raise ImportError("arcpy needs to run within an active ArcGIS Conda environment")
ImportError: arcpy needs to run within an active ArcGIS Conda environment
  • Welcome to GIS SE. I encourage you to post your error as formated text rather than as a picture. Furthermore, what's the path of the interpreter you configured for your project in PyCharm? – Marcelo Villa Jun 26 '19 at 15:21
  • 1
    Thanks Marcelo for the feed back. Updates done to the original post. – CXLOPE13 Jun 26 '19 at 15:37
  • Do you have a Python interpreter located at C:\Users\C5LB\AppData\Local\Programs\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe? That is the one I use in PyCharm and it works fine. If I create another environment I just have to change that in the envs folder. – Marcelo Villa Jun 27 '19 at 3:16
  • Oh! It worked! yes, so I just needed to change the env to where the interpreter is located within ArcGIS\pro instead of using the clone in conda. – CXLOPE13 Jun 27 '19 at 15:30

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.