PyCharm
From Install to Remote Dev
Master the world's most powerful Python IDE — from your first venv to running code on a remote server over SSH.
Visual Debugger
Set breakpoints, step through code line-by-line, inspect any variable — all without touching the terminal.
True Remote Development
Write code locally, run it on a remote server over SSH. Your files sync automatically. Feels like the server is your laptop.
Free for Students
JetBrains gives every student with a .edu email a free Professional license — worth $249/year. No credit card needed.
Install & First Project
- Free Pro license with .edu email
- New project with Anaconda Python
- Run a script & Jupyter Notebook
Interface Tour
- Project panel, editor, tool windows
- Status bar & Python interpreter indicator
- Search Everywhere & quick actions
Interpreters & venv
- System Python vs virtualenv vs conda
- Create & switch interpreters in PyCharm
- Install packages via GUI
Debugging
- Breakpoints, step over, step into
- Variables panel & watches
- Interactive debugger animation
Terminal
- Built-in terminal with venv auto-activation
- Multiple tabs & split terminals
- Python Console & Jupyter
Git & GitHub
- Create GitHub repo, clone into PyCharm
- Commit, push & verify on github.com
- Clone textbook & reference repos
SSH & AWS Remote Interpreter
- SSH config: IPv4 IP, ubuntu, .pem key
- Add AWS as a Python interpreter
- Run code on AWS, switch interpreters
AWS Deployment & File Sync
- SFTP deployment to AWS EC2
- Local ↔ remote path mapping
- Upload, sync, remote file browser
Shortcut Cheat Sheet
- Every essential shortcut by category
- Mac & Windows/Linux side-by-side
- Copy any shortcut with one click
Community vs Professional
| Feature | Community (Free) | Professional (Free with .edu) |
|---|---|---|
| Python editing & completion | ✅ | ✅ |
| Debugger | ✅ | ✅ |
| Git integration | ✅ | ✅ |
| SSH Remote Interpreter | 🚫 | ✅ |
| Deployment & file sync | 🚫 | ✅ |
| Jupyter Notebook support | 🚫 | ✅ |
| Database tools | 🚫 | ✅ |
| Django / Flask support | 🚫 | ✅ |
| Docker integration | 🚫 | ✅ |
.edu email address, you qualify for JetBrains' free educational license — this gives you PyCharm Professional plus every other JetBrains IDE.Step 1 — Get the Free Student License
Navigate to jetbrains.com/student and click "Apply now".
yourname@university.edu). JetBrains verifies it automatically — no documents needed.Click the confirmation link. JetBrains will create a JetBrains Account linked to your .edu address.
Choose the Professional edition. There is also a JetBrains Toolbox App (recommended) that manages all JetBrains IDEs and updates them automatically.
On first launch, choose "Log in to JetBrains Account" and enter the account you created with your .edu email. The license activates instantly.
First-Launch Setup
On the welcome screen, click "New Project". Choose a folder, select "Python" as project type, and pick "New environment using Virtualenv" — PyCharm will create a virtual environment automatically.
PyCharm will look for Python installations on your system. If you don't see Python 3.10+, install it from python.org first, then re-open PyCharm.
~/projects/my_project/.venvRight-click the project root in the Project panel → New → Python File. Name it main.py. Type print("Hello, PyCharm!") and press ⌃R (Mac) or Shift+F10 (Windows) to run it.
Quick Start: Local Project with Anaconda
For data science and deep learning, Anaconda is the recommended Python distribution. Follow these steps to connect your existing Anaconda installation to a new PyCharm project instead of creating a new virtualenv.
Mac: Open a Terminal (Utilities → Applications), run
which python, and copy the result (e.g., /opt/anaconda3/bin/python).Windows: The default Anaconda path is
C:\ProgramData\anaconda3\python.exeChoose the directory where your project files will live.
Then set Environment to Select existing and Type to Python.
PyCharm creates the project using your Anaconda Python, giving you immediate access to NumPy, Pandas, TensorFlow, and all other Anaconda packages.
Test with a Python Script
python_eval → press Return
Enter the two lines below in the editor, then right-click anywhere in the editor and select Run 'python_eval'.
import numpy as np
print('hello world')
Test with a Jupyter Notebook
python_eval
PyCharm opens the notebook in its built-in Jupyter editor. A new .ipynb file appears in your project.
print('hello world') in the cell → press Shift+Return to run it
The cell executes and hello world appears immediately below it with a green checkmark and a timing badge.
- Apply for JetBrains Student License with your .edu email
- Download and install PyCharm Professional, activate with your JetBrains Account
- Find your Anaconda Python path (Mac:
which pythonin Terminal) - Create a new project using Custom Environment → Select existing → paste Anaconda Python path
- Create
python_eval.py, enterimport numpy as npandprint('hello world'), and run it - Create a Jupyter Notebook, run
print('hello world')with Shift+Return, verify output
The PyCharm Layout
1 def greet(name):
2 return f"Hello, {name}!"
3
4 ● result = greet("World")
5 print(result)
Key Areas
| Area | What it's for | How to open |
|---|---|---|
| Project Panel | File tree of your project | ⌘1 / Alt+1 |
| Editor | Where you write code — center stage | Click any file |
| Run Panel | Output from running your script | ⌘4 / Alt+4 |
| Debug Panel | Breakpoints, variables, call stack | ⌘5 / Alt+5 |
| Terminal | Shell inside the IDE | ⌥F12 / Alt+F12 |
| Python Console | Interactive REPL | Tools → Python Console |
| Git Panel | Commit, log, branches | ⌘9 / Alt+9 |
| Deployment | Remote server file sync | Tools → Deployment |
The Most Important Shortcuts
| Action | Mac | Windows/Linux |
|---|---|---|
| Search Everywhere | ⇧⇧ (double Shift) | Shift Shift |
| Run file | ⌃R | Shift+F10 |
| Debug file | ⌃D | Shift+F9 |
| Find & Replace | ⌘R | Ctrl+R |
| Go to definition | ⌘B or ⌘Click | Ctrl+B or Ctrl+Click |
| Reformat code | ⌘⌥L | Ctrl+Alt+L |
| Comment/uncomment | ⌘/ | Ctrl+/ |
| Settings | ⌘, | Ctrl+Alt+S |
- Open the Project panel (⌘1) and find your
main.py - Use double-Shift to search for "Python Console" and open it
- Run your script with ⌃R and see output in the Run panel
- Change the theme: Settings → Appearance → Theme
Types of Interpreters
Create a New Virtualenv
Mac: ⌘, → Project → Python Interpreter. Windows: Ctrl+Alt+S → Project → Python Interpreter.
Select Virtualenv Environment → New. PyCharm suggests a path like project-folder/.venv. Choose the base Python version (e.g., Python 3.11).
You'll see the interpreter change in the status bar (bottom right). Future package installs go into this venv only.
Switch Between Interpreters
Click the interpreter name in the bottom-right status bar — a popup lets you switch instantly between any interpreter configured for that project.
Install Packages via PyCharm
You see a list of installed packages. Click the + button.
PyCharm runs pip install numpy in your venv. You can see the output in the panel below.
requirements.txt automatically. If it sees missing packages, a yellow banner appears in the editor with a one-click "Install requirements" button.Conda Environments
# Create a conda environment with a specific Python version conda create -n ml-project python=3.11 numpy pandas scikit-learn conda activate ml-project # Then in PyCharm: Add Interpreter → Conda Environment → Existing # PyCharm finds conda automatically if it's in your PATH
- Open Settings → Python Interpreter and see the current venv
- Install the
requestspackage via the PyCharm GUI - Click the interpreter in the status bar and confirm it shows your venv
print() statements everywhere, you set a breakpoint — the program stops there and waits for your instructions.
Interactive Debugger — Step Through Code
Press Run Debug to start. Use the buttons to step through the code and watch the variables update in real time.
Debug Controls
| Control | Mac | Win/Linux | What it does |
|---|---|---|---|
| ▶ Resume / Run Debug | ⌃D | Shift+F9 | Start debug / run to next breakpoint |
| ⤵ Step Over | F8 | F8 | Execute current line, stay in this function |
| ⤴ Step Into | F7 | F7 | Step into the function call on current line |
| ⤶ Step Out | ⇧F8 | Shift+F8 | Finish current function, return to caller |
| ⏩ Run to Cursor | ⌥F9 | Alt+F9 | Run until the line where cursor is |
| ⏹ Stop | ⌘F2 | Ctrl+F2 | Kill the debug session |
Breakpoints
Click the gutter (the narrow strip left of the line numbers) to set a red breakpoint dot. Click again to remove it. The program will pause just before executing that line.
average < 80. The program only stops when that condition is true — saves time when debugging loops with thousands of iterations.The Variables Panel
When paused at a breakpoint, the Variables panel shows every variable in scope. You can:
- Expand lists, dicts, and objects to see their contents
- Right-click a variable → Set Value to change it live while debugging
- Right-click → Copy Value to grab the current value
Watches & Evaluate Expression
In the Variables panel, click "+" → New Watch". Type any expression like total * 2 or len(scores). It updates automatically at every step.
Press ⌥F8 (Mac) or Alt+F8 (Win) while paused. Type any Python expression — it runs in the current scope. Great for testing a fix without restarting the whole program.
- Use the interactive debugger above — step through all lines
- Set a breakpoint in your own
main.pyand run in debug mode (⌃D) - While paused, add a Watch expression and see it update
- Try Evaluate Expression (⌥F8) to run a quick calculation while paused
The Built-in Terminal
PyCharm has a full terminal emulator built in. The key advantage: it automatically activates your project's virtual environment when it opens. No need to manually run source .venv/bin/activate every time.
Notice the (.venv) prefix — the virtual environment is active. Any pip install here goes into your project's isolated environment.
Open the Terminal
| Action | Mac | Windows/Linux |
|---|---|---|
| Open Terminal | ⌥F12 | Alt+F12 |
| New terminal tab | ⌘T in terminal | Ctrl+Shift+T |
| Close tab | ⌘W | Ctrl+W |
| Split terminal | Right-click tab → Split | Right-click → Split |
Multiple Terminal Tabs
You can open multiple terminal tabs — useful for running a server in one tab and sending requests in another:
python app.py
# server running on http://127.0.0.1:5000
curl http://127.0.0.1:5000/api/data
Python Console vs Terminal
| Terminal | Python Console | |
|---|---|---|
| What it is | Full shell (bash/zsh/PowerShell) | Interactive Python REPL |
| Best for | Running scripts, git, pip, system commands | Exploring objects, testing snippets |
| Opens with venv | ✅ Automatic | ✅ Uses project interpreter |
| Can import your modules | Only if you run python first | ✅ Yes, directly |
| Open via | ⌥F12 | Tools → Python Console |
Changing the Default Shell
Settings → Tools → Terminal → Shell path. Set it to /bin/zsh, /bin/bash, or C:\Program Files\Git\bin\bash.exe on Windows.
- Open the terminal (⌥F12) and verify
(.venv)is shown - Install a package with
pip install requestsin the terminal - Open a second terminal tab and split it
- Open the Python Console and import your installed package
Enable VCS / Connect a Repo
Or open an existing repo: File → Open → select the folder. PyCharm detects .git/ automatically.
Click + and paste your GitHub URL. Name it origin.
https://github.com/your-username/your-repo.git
The Commit Workflow
A panel shows all changed files. Check the ones you want to stage, write a commit message, and press "Commit" or "Commit and Push".
Click any changed file in the panel to see a side-by-side diff right there. Red = removed, green = added. You can even edit directly in the diff view.
A dialog shows the commits about to be pushed and the target branch. Confirm and click Push.
Key Git Actions
| Action | Mac | Windows |
|---|---|---|
| Commit | ⌘K | Ctrl+K |
| Push | ⌘⇧K | Ctrl+Shift+K |
| Pull | ⌘T | Ctrl+T |
| View Git Log | ⌘9 → Log tab | Alt+9 → Log |
| New Branch | Git menu → New Branch | Git → New Branch |
| Annotate (blame) | Right-click gutter → Annotate | Right-click → Annotate |
| Revert file | ⌘⌥Z | Ctrl+Alt+Z |
Resolving Merge Conflicts Visually
When a merge conflict occurs, PyCharm opens a 3-panel merge tool:
Click the → or ← arrows to accept a change from either side into the Result panel. When done, click "Apply". PyCharm marks the conflict as resolved automatically.
Git Log Viewer
Open the Git panel (⌘9 / Alt+9) → click the Log tab. You see the full commit graph, click any commit to inspect changes, filter by author, branch, or date, and right-click to cherry-pick or revert.
Connecting PyCharm to GitHub: Clone-First Workflow
Enter a name (e.g., PycharmGitHub), choose Private, and click Create repository. You can make it public later — private repos are visible only to people you share them with.
Enter your GitHub username and password if prompted. All your repositories will appear in the list.
PycharmGitHub from the list — verify the local directory — click Clone
PyCharm clones the (empty) repository and opens it as a new project. There will be no files yet.
EvalGithub
Enter the line below. Notice the filename appears in green — this means it is a new file not yet tracked by Git.
print('Hello World')
Type a description like Add file EvalGithub.py in the message box at the bottom of the Commit panel. Click Commit and Push….
Cloning Reference Repositories
To clone any public GitHub repository, click Clone Repository → Repository URL and paste the URL. Two repositories worth cloning for this course:
| Repository | Contents |
|---|---|
github.com/NNDesignDeepLearning/ | All textbook chapters and lab files. Clone this to run labs in PyCharm locally or on your AWS instance. |
github.com/amir-jafari/Deep-Learning | TensorFlow and PyTorch example programs for the two deep learning frameworks used in this course. |
- Create a Private repository on github.com named
PycharmGitHub - Clone it into PyCharm via Clone Repository → GitHub → Log In via GitHub
- Create
EvalGithub.py, enterprint('Hello World')— verify filename is green - Commit and Push — verify the file appears on github.com
- Clone the NNDesignDeepLearning textbook repository by URL
- Clone the amir-jafari/Deep-Learning repository by URL
How It Works
local files
GPU / HPC cluster
PyCharm Run panel
Step 1 — Add SSH Credentials
Click + to add a new SSH connection. Fill in:
| Field | Generic | AWS EC2 (Ubuntu AMI) |
|---|---|---|
| Host | hpc.university.edu | Your instance's IPv4 Public IP |
| Port | 22 | 22 |
| Username | your_netid | ubuntu |
| Auth type | Key pair or Password | Key pair |
| Private key | ~/.ssh/id_ed25519 | Path to your .pem file |
ubuntu for Ubuntu-based AMIs. Select Key pair as the authentication type and browse to the .pem file you downloaded when launching the instance. Click Test Connection to verify the connection before saving.PyCharm will try to SSH into the server. You should see a green "Successfully connected" message. If not, check the host, port, and key path.
Step 2 — Configure the Remote Interpreter
Select the SSH configuration you just created. PyCharm will connect and browse the remote Python installations.
Navigate to the Python path on the remote server, e.g. /usr/bin/python3 or the path to a conda env:
# System Python /usr/bin/python3 # Conda environment on remote /home/username/miniconda3/envs/myenv/bin/python # Module-loaded Python on HPC # First SSH in and run: module load python/3.11 && which python
PyCharm asks where to copy your files on the remote server, e.g. /home/username/projects/my_project. This is where your code will live on the remote.
Running Code Remotely
After setup, just press Run (⌃R) as normal. PyCharm will:
- Sync your local files to the remote server
- Execute the script using the remote Python interpreter
- Stream
stdoutandstderrback to your local Run panel
Install Remote Packages
# PyCharm runs pip install on the REMOTE server for you
ssh ubuntu@<your-ipv4-public-ip> pip install torch torchvision
Connecting to AWS: Complete Remote Interpreter Setup
In the New Target: SSH dialog, select Existing for SSH Connection and choose your AWS configuration from the dropdown. Click Next, then Next again.
Click Browse on the Sync folders field and select your local project directory. Click Browse on the Remote path field and navigate to the directory on the AWS instance where your project lives (e.g., /home/ubuntu/PythonProject1). Click OK and OK.
The remote interpreter appears in the list (e.g., Remote Python 3.12.3 (sftp://ubuntu@…)). Click on it to select it.
Giving it a clear name makes it easy to identify when switching between local and remote.
Wait for the update to finish (visible in the status bar at the bottom). Once complete, you can run python_eval.py — it now executes on your AWS instance, not your local computer.
Click the interpreter name in the status bar (bottom right of the PyCharm window). A popup lists all configured interpreters — select AWS to run remotely, or your local Anaconda interpreter to run locally.
- Add SSH credentials: Host = IPv4 Public IP, Username =
ubuntu, Auth = Key pair (.pem file) - Click Test Connection — verify it shows "Successfully connected"
- Settings → Project → Python Interpreter → Add Interpreter → On SSH → select Existing → AWS
- Select System Interpreter, set Sync folders (local) and Remote path (on AWS), click Create
- Rename the remote interpreter to AWS via the pencil icon — click OK, OK, OK
- Run
python_eval.pyand confirm it runs on the AWS instance - Switch between Local and AWS using the interpreter selector in the bottom-right corner
Deployment (this module) = a dedicated SFTP server configuration that gives you manual and automatic control over file sync — including upload on save, selective sync, and a visual remote file browser.
How Local ↔ Remote Mapping Works
💻 Local (Your Laptop)
🖥️ Remote Server
Step 1 — Configure a Deployment Server
Via menu:
Tools → Deployment → Configuration… (quickest)Via Settings:
Settings → Build, Execution, Deployment → DeploymentEnter a name for the server (e.g., AWS) and click OK.
Fill in the SSH connection details for your AWS instance:
| Field | Value |
|---|---|
| Host | Your instance's IPv4 Public IP |
| Port | 22 |
| Username | ubuntu |
| Authentication type | Key pair |
| Private key file | Path to your .pem file |
Click Test Connection to verify. Click the pencil icon above the left column and rename the connection to AWS. Click OK.
Set the Root path to the base directory on your AWS instance (e.g., /home/ubuntu/projects). Click OK to save the deployment server configuration.
Step 2 — Set Path Mappings
Add a mapping that tells PyCharm which local folder corresponds to which remote folder:
| Local Path | Deployment Path |
|---|---|
| /Users/you/projects/my_project | /home/netid/projects/my_project |
| /Users/you/projects/my_project/data | /scratch/netid/data |
You can have multiple mappings — for example, your main code folder maps to your home directory, but a large data folder maps to a scratch/data partition on the server.
Step 3 — Configure Excluded Paths
Add any paths you do NOT want to upload to the server:
.venv/ # local venv — remote has its own __pycache__/ .git/ *.local.py # local-only config files .DS_Store
Upload Options
| Method | How | When to use |
|---|---|---|
| Manual upload | Right-click file → Deployment → Upload to … | One-off uploads |
| Upload all | Tools → Deployment → Upload to … | Initial sync of whole project |
| Auto-upload on save | Tools → Deployment → Options → Upload on explicit save | Active development on remote |
| Sync (compare) | Tools → Deployment → Sync with Deployed … | Check what differs before syncing |
Remote File Browser
Go to Tools → Deployment → Browse Remote Host. A panel opens showing the remote file system:
From this browser you can:
- Double-click any file to open and edit it directly (changes save back to the server)
- Right-click → Download to pull files to local
- Right-click → Delete, Rename, New File/Directory
- Drag files between local Project panel and Remote Files panel
Compare Local vs Remote
Right-click any local file → Deployment → Compare with Deployed Version. PyCharm shows a diff of the local file vs what's currently on the server — useful to confirm you haven't forgotten to upload something.
- Tools → Deployment → Configuration → + → SFTP → name it AWS
- Configure SSH: IPv4 Public IP, username
ubuntu, Key pair (.pem file), Test Connection - Set a path mapping: local project folder → remote directory on AWS
- Right-click a Python file → Deployment → Upload — verify it appears on the AWS instance
- Open Tools → Deployment → Browse Remote Host and explore the AWS file tree
- Use Tools → Deployment → Sync with Deployed to compare local and remote files
| Run file | ⌃R / Shift+F10 |
| Debug file | ⌃D / Shift+F9 |
| Step Over | F8 |
| Step Into | F7 |
| Step Out | ⇧F8 / Shift+F8 |
| Resume program | ⌘⌥R / F9 |
| Evaluate expression | ⌥F8 / Alt+F8 |
| Toggle breakpoint | ⌘F8 / Ctrl+F8 |
| Stop | ⌘F2 / Ctrl+F2 |
| Search Everywhere | ⇧⇧ / Shift+Shift |
| Go to file | ⌘⇧O / Ctrl+Shift+N |
| Go to class | ⌘O / Ctrl+N |
| Go to symbol | ⌘⌥O / Ctrl+Alt+Shift+N |
| Go to definition | ⌘B / Ctrl+B |
| Find usages | ⌥F7 / Alt+F7 |
| Go to line | ⌘L / Ctrl+G |
| Back / Forward | ⌘[ / ⌘] / Ctrl+Alt+←/→ |
| Recent files | ⌘E / Ctrl+E |
| Auto-complete | ⌃Space / Ctrl+Space |
| Reformat code | ⌘⌥L / Ctrl+Alt+L |
| Comment line | ⌘/ / Ctrl+/ |
| Duplicate line | ⌘D / Ctrl+D |
| Delete line | ⌘⌫ / Ctrl+Y |
| Move line up/down | ⇧⌘↑/↓ / Shift+Alt+↑/↓ |
| Rename (refactor) | ⇧F6 |
| Surround with | ⌘⌥T / Ctrl+Alt+T |
| Quick fix | ⌥↩ / Alt+Enter |
| Commit | ⌘K / Ctrl+K |
| Push | ⌘⇧K / Ctrl+Shift+K |
| Pull | ⌘T / Ctrl+T |
| Git log | ⌘9 → Log / Alt+9 |
| Annotate (blame) | Gutter right-click |
| Revert file | ⌘⌥Z / Ctrl+Alt+Z |
| Compare with branch | Git → Compare with Branch |
| Project panel | ⌘1 / Alt+1 |
| Bookmarks | ⌘2 / Alt+2 |
| Run panel | ⌘4 / Alt+4 |
| Debug panel | ⌘5 / Alt+5 |
| Git panel | ⌘9 / Alt+9 |
| Terminal | ⌥F12 / Alt+F12 |
| Python console | Tools → Python Console |
| Settings | ⌘, / Ctrl+Alt+S |
| Hide all panels | ⇧⌘F12 / Ctrl+Shift+F12 |
| Find in file | ⌘F / Ctrl+F |
| Replace in file | ⌘R / Ctrl+R |
| Find in project | ⌘⇧F / Ctrl+Shift+F |
| Replace in project | ⌘⇧R / Ctrl+Shift+R |
| Next occurrence | ⌘G / F3 |
| Highlight usages | ⌘⇧F7 / Ctrl+Shift+F7 |