This tutorial is about using PyCharm IDE on a Windows machine to remotely execute Python programs on Raspberry Pi. This step by step tutorial on how to remotely connect PyCharm to Raspberry Pi and use the Raspberry Pi python interpreter to execute the programs is tested on a Windows 10 machine and Raspberry Pi running Raspbian OS.
- Step by step configuration
- Create git repository
- Share on GitHub
- Debug DISPLAY configuration
- Credits
- Author
Ensure the Windows Machine and Raspberry Pi are part of the same Network.
Install PyCharm Professional Edition on your Windows machine.
You need to get the IP Address of Raspberry Pi. To do so, open the Terminal window on raspberry pi and type the following command ifconfig (here it's 192.168.1.42):
pi@raspberrypi:~ $ ifconfig
eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.42 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 2a01:cb15:811a:800:ca7b:d8b1:eef3:94d0 prefixlen 64 scopeid 0x0<global>
inet6 fe80::b77f:4360:7571:b634 prefixlen 64 scopeid 0x20<link>
ether b8:27:eb:b4:2b:f9 txqueuelen 1000 (Ethernet)
RX packets 829885 bytes 309193514 (294.8 MiB)
RX errors 0 dropped 85330 overruns 0 frame 0
TX packets 163367 bytes 16088873 (15.3 MiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
lo: flags=73<UP,LOOPBACK,RUNNING> mtu 65536
inet 127.0.0.1 netmask 255.0.0.0
inet6 ::1 prefixlen 128 scopeid 0x10<host>
loop txqueuelen 1000 (Local Loopback)
RX packets 41 bytes 2444 (2.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 41 bytes 2444 (2.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
wlan0: flags=4099<UP,BROADCAST,MULTICAST> mtu 1500
ether b8:27:eb:e1:7e:ac txqueuelen 1000 (Ethernet)
RX packets 0 bytes 0 (0.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 0 bytes 0 (0.0 B)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0Create props project folder on the Raspebrry:
pi@raspberrypi:~/Room $ pwd
/home/pi/Room
pi@raspberrypi:~/Room $ mkdir PyTvScripter
pi@raspberrypi:~/Room $ ls
PyTvScripter Relay
pi@raspberrypi:~/Room $ Invoke your PyCharm IDE. Create a new Project. Go to File —> New Project —> Pure Python —> Give a Project Name. In this case it is PyTvScripter.
Right Click on PyTvScripter and select New —> Python File and give a name to python file. In this case it is tvscripter.py
Write the line print("Hello RaspberryPi") in the editor.
Now go to File —> Settings —> Project: PyTvScripter —> Project Interpreter
On the right pane of the window, click on teh gear button at the end of Project Interpreter and select Add... Then select SSH Interpreter and fill in the New server configuration with the Raspberry IP address and pi user, then Apply:
Complete with credentials for pi user:
When connected to the Raspberry, browse remote drive to select Python 3 interpreter:
Remote SSH interpreter is now configured:
Now on Apply, deployment configuration is created automatically:
Click Configure... —> Mappings and set the correct path for deployment on the Raspberry:
Now go to File —> Settings —> Project: PyTvScripter —> Project Interpreter to check SSH configuration is completed:
Now we need to upload the Python file created on our Windows machine on to Raspberry Pi and compile the program using Raspberry Pi Python Interpreter.
Select PyTvScripter folder in Project left panel and go to Tools —> Deployment —> Upload to pi@192.168.1.42:22:
Click Add Configuration... button to add a Python Remote Debug configuration:
- you don't have to do anything else (despite what is mentioned in the screenshot below, I guess PyCharm current version 2019.3 does it for us)
Now got to Run —> Debug and start the remote debugging:
Verify the Debug configuration:
Start debug and select Debug panel:
At first start, TvScripter App has created two files:
- .config.yml
- pytvscripter.log
Synchronize with the Raspberry:
Click the synhronize button in the synchronization dialog:
Voilà! We can start working on our PyTvScripter project...
Go to VCS —> Import into version Control —> Create Git Repository...
Go to VCS —> Import into version Control —> Share Project on GitHub... and login with you credentials
Complete the repository description and share:
Do not add .idea folder:
If you missed it, you can remove .idea from git with:
$ git rm --cached -r .ideaTo run remote application in GUI (for guizero for example), add DISPLAY configuration in session environment variables:
This guide is an adaptation of Remote Programming of Raspberry Pi using PyCharm by Gowrishankar S, published in 2016 at https://www.gowrishankarnath.com/remote-programming-of-raspberry-pi-using-pycharm.html
Faure Systems (Oct 9th, 2019)
- company: FAURE SYSTEMS SAS
- mail: dev at faure dot systems
- github: fauresystems
- web: Faure Systems




















