How to set up PyCharm

Dr. Huidae Cho
Institute for Environmental and Spatial Analysis...University of North Georgia

1   Create your own Python environment from ArcGIS Pro Python 3

We’ll use Python 3 provided by Esri’s ArcGIS Pro because it has a lot of useful modules already installed. All you need to do is copy C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3 to P:\arcgispro-py3 so you have P:\arcgispro-py3\python.exe

copy-arcgispro-py3.png

2   Install PyCharm

If you don’t already have PyCharm on your computer, please go to Software Center and install it. Start PyCharm for the first time. Don’t import any settings because you don’t have any.

pycharm-import.png

This configuration is not important. If you don’t know what this is about, just accept the default.

pycharm-initial-config.png

Go to Configure => Settings => Default Project => Project Interpreter => Gear Icon

pycharm-config.png pycharm-default-project-interpreter.png pycharm-project-interpreters.png

Click the Plus icon and choose “Add Local.” From there, select P:\arcgispro-py3\python.exe.

pycharm-select-python-interpreter.png

Select the python.exe you just added from Project Interpreters.

pycharm-project-interpreters-selected.png

3   Install the Pillow module

Click the Plus icon.

pycharm-project-interpreter-add-packages.png

Oops! There are no available packages? Go to “Manage Repositories” and add https://www.python.org/pypi.

pycharm-no-available-packages.png pycharm-manage-repositories.png

Ah! That didn’t help at all. The list of available packages was still empty and https://www.python.org/pypi kept disappearing from the repositories list. I even tried the default Python interpreter C:\Program Files\Python35\python.exe. This one was even worse. I was getting a “Non-zero exit code” error at the bottom of the window and the package list just kept loading. The Plus icon gave me the same empty list even if there was one repository “https://pypi.python.org/pypi.” Nice job, PyCharm! Out-of-the-box experience from fresh PyCharm was a little disappointing. Anyway, if you have the same issue, you can just install packages manually from cmd.exe.

P:
cd \arcgispro-py3
scripts\pip install pillow

4   Create a new project

Every time you create a new project, just make sure to select your arcgispro-py3 interpreter.

pycharm-create-project.png

Add a new Python file (File => New => Python File) and type this code:

import PIL
import sys

print(sys.version)

Run (Shift+F10) it. Do you see output like this at the bottom?

P:\arcgispro-py3\python.exe C:/Users/hcho/PycharmProjects/test/test.py
3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]

Process finished with exit code 0

What’s next? Study Python basics.