Select to view content in your preferred language

Need Help Configuring PyCharm to work with ArcGIS Pro ArcPy

3125
2
Jump to solution
03-05-2019 03:28 PM
ArthurCallan
Emerging Contributor

Hello, I am currently taking the Esri Python for Everyone course for my work since they slowly upgrading us to ArcGIS Pro, and I have ran into an issue trying to configure PyCharm to work with ArcGIS Pro ArcPy. I have used Python some with ArcMap and this is the first time using PyCharms, so I am not the most experienced with Python. I have selected the 3.6.2 python.exe for the system and project interpreter, but every time I open the Python Console in PyCharm, it cannot connect to the console process. I went back through the lesson two more times to make sure I set it up correctly, but to no avail. I got the interpreter from "C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" just like the lesson said to.

Out of curiosity, I decided to try and see if changing the interpreter to ArcMaps 2.7.13 ArcPy would work and it connected right away. After not being able to connect with ArcPy 3.6.2, I found this link Configure your Python IDE to work with ArcMap and ArcGIS Pro’s ArcPy and it was not any help either as I came across the same issues. My co-workers who are taking the same courses were able to connect and I seem to be the only one that is having issues connecting. Can anyone point me in the right direction in getting this solved so I can proceed with my python lessons! Figured I would ask here to see if it was an error on my end before asking IT to reinstall my programs.

Thanks!

0 Kudos
1 Solution

Accepted Solutions
curtvprice
MVP Esteemed Contributor

First thought I have:

Check your system PATH and make sure you do not have a PYTHONPATH variable set, this can mess up what's in the path when Python starts up. Some other Python installers sometimes mess with the PYTHONPATH variable and that will mess up the sys.path.

A good way to check the path is to start up the interpreter and look at the sys.path to make sure it only is pointing to the right places, for example, you don't have paths pointing to another version of Python.

H:\>"c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\python.exe"
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; print ("\n".join(sys.path))
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\python36.zip
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\DLLs
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages
C:\Program Files\ArcGIS\Pro\bin
C:\Program Files\ArcGIS\Pro\Resources\ArcPy
C:\Program Files\ArcGIS\Pro\Resources\ArcToolbox\Scripts
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\future-0.16.0-py3.6.egg
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\pytz-2018.5-py3.6.egg
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\sympy-1.2-py3.6.egg
>>>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

View solution in original post

2 Replies
curtvprice
MVP Esteemed Contributor

First thought I have:

Check your system PATH and make sure you do not have a PYTHONPATH variable set, this can mess up what's in the path when Python starts up. Some other Python installers sometimes mess with the PYTHONPATH variable and that will mess up the sys.path.

A good way to check the path is to start up the interpreter and look at the sys.path to make sure it only is pointing to the right places, for example, you don't have paths pointing to another version of Python.

H:\>"c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\python.exe"
Python 3.6.6 |Anaconda, Inc.| (default, Jun 28 2018, 11:27:44) [MSC v.1900 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys; print ("\n".join(sys.path))
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\python36.zip
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\DLLs
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages
C:\Program Files\ArcGIS\Pro\bin
C:\Program Files\ArcGIS\Pro\Resources\ArcPy
C:\Program Files\ArcGIS\Pro\Resources\ArcToolbox\Scripts
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\future-0.16.0-py3.6.egg
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\pytz-2018.5-py3.6.egg
c:\Program Files\arcgis\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\sympy-1.2-py3.6.egg
>>>‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
ArthurCallan
Emerging Contributor

Thank you so much for your response! It took awhile, but your response put me on the right path to figuring it out. I tried changing system path per your recommendation, and I noticed I was not allowed to change the system path as that option did not exist, only default paths (which I thought was system). That lead me to go check a co-workers PC and saw their UI was different. I checked the version of PyCharm on my PC. Somehow IT installed a PyCharm build from 2014, while my other co-workers had a 2018 build. Simply updating my software allowed it to read the newer version Python. Thanks again!