Configuring Python IDE with 3.5 installed with ArcGIS Pro

2803
7
Jump to solution
06-23-2017 08:30 AM
mpboyle
Regular Contributor

I'm by far an expert when it comes to Python...so, I generally use PyCharm when it comes to writing scripts as I find it to be a great IDE for Python.

I'm starting the process of moving some of my 2.7.x scripts to 3.5.x for use with ArcGIS Pro.  I have configured PyCharm to use the python interpreter packaged with ArcGIS Pro 1.4.1, located at the following: C:\Program Files\ArcGIS\Pro\bin\Python.

However, arcpy is not recognized as an available module.

If I run sys.path from within PyCharm, I get the following paths:

If I run sys.path from within ArcGIS Pro, I get the following paths:

What do I need to do in order to get PyCharm to be able to use arcpy?  Do I need to add system environmental variable paths?  If so, from the list returned in ArcGIS Pro, how many need to be added?

Is there some other way of getting the arcpy module to be recognized within PyCharm?

Is there a best practice that is used with python?

Thanks!

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
ClintonDow1
Occasional Contributor II

There is a python.exe within the %Pro%\bin\Python\envs\arcgispro-py3 folder which should work if set as a project interpreter in PyCharm. 

View solution in original post

7 Replies
sapnas
by
Occasional Contributor III

Have you checked the below link 

Error: ImportError: No module named arcpy 

0 Kudos
mpboyle
Regular Contributor

I'm not running on a machine that has Server installed.

0 Kudos
mpboyle
Regular Contributor

I was able to add in content source folders for my project, and when running sys.path, it returns the folders that are shown within ArcGIS Pro (screenshot below), but I am still getting an error that a module can't be found.

sys.path

error message with importing arcpy

0 Kudos
sapnas
by
Occasional Contributor III

Not sure about pro but in Desktop the below tip from arcgis help  worked. THere must be something equivalent in pro as well

TipTip:

If importing ArcPy produces either of the following errors, the required modules could not be found:

  • ImportError: No module named arcpy
  • ImportError: No module named arcgisscripting

To address this, browse using Windows Explorer to the python26\Lib\site-packages folder and add or edit the Desktop10.pth file. The file should contain the two lines shown below (corrected to your system's path if they do not match):

c:\Program Files\ArcGIS\Desktop10.0\arcpy c:\Program Files\ArcGIS\Desktop10.0\bin
0 Kudos
sapnas
by
Occasional Contributor III
0 Kudos
ClintonDow1
Occasional Contributor II

There is a python.exe within the %Pro%\bin\Python\envs\arcgispro-py3 folder which should work if set as a project interpreter in PyCharm. 

View solution in original post

mpboyle
Regular Contributor

Thank you so much, this works!