Python/ArcPy Installation – Setting Up with ArcGIS Pro and Visual Studio

arcgis-proarcpyinstallationvisual studio

My ArcGIS Pro install recently updated from 1.2 to 1.3.

In reading Python in ArcGIS Pro 1.3 I discovered that Esri have changed how ArcGIS Pro uses Python/ArcPy.

Legacy:
In ArcGIS Pro 1.0 through 1.2, if you needed to use Python
outside of ArcGIS Pro, you also had to install Python for ArcGIS Pro.
With changes at 1.3, this is no longer required. To avoid confusion,
uninstall Python for ArcGIS Pro.

I uninstalled Python for ArcGIS Pro, but now I can't get my IDE (Visual Studio 2013) to see arcpy anymore. In fact I don't think it's seeing Python 3 at all (switching to Python 2.7 still works)

Broken link to arcpy:
enter image description here

Unable to Select Python 3:
enter image description here

As I read that ArcGIS Pro 1.3 uses Anaconda I tried installing that, but it was installed to a completely new location and still I had no access to arcpy from VS.

How can I make Visual Studio see arcpy again?

Best Answer

Python/ArcPy for ArcGIS Pro 1.3 is now installed in

C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\

So your IDE needs to be pointed at that environment to pick up the link to arcpy.

In Visual Studio open the Python Environments window, click "+ Custom..." and select "Configure".

Give the new environment a name e.g. Python 64-bit 3.5 ArcPy and populate the path fields with the path above, specifying the relevant file in that path for each field.

  • Prefix Path: C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\
  • Interpreter Path: C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe
  • Windowed Interpreter: C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\pythonw.exe
  • Library Path: C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\Lib
  • Language Version: 3.5
  • Architecture: 64-bit

Click Apply on the right.

enter image description here

For more information see Python and ArcGIS Pro 1.3 : Conda, which includes help for other IDEs as well.

Related Question