PyCharm is among the most popular IDEs for Python development. This tutorial provides all the steps required to install PyCharm for Python development on Ubuntu 18.04 LTS. The steps should be similar for other versions of Ubuntu and Linux systems.
You might also be interested in How To Install Python 3.8 On Ubuntu 18.04 LTS, How To Install Eclipse For Python On Ubuntu, and How To Install VSCode For Python On Ubuntu for Python development on Ubuntu.
Download PyCharm
Download PyCharm from the official website of JET BRAINS. The PyCharm is distributed as Professional for pure Python and Web Python development and Community for pure Python development as shown in Fig 1. In this tutorial, we will download the Community edition. The installation steps are the same for both Community and Professional editions.
Install PyCharm
In this step, we will install PyCharm using the installer downloaded in the previous step. Now extract the installer to appropriate location and navigate to the bin directory as shown in Fig 2.
Desktop Shortcut
We can also create a desktop shortcut icon using the icon and executable highlighted in Fig 2 to launch the PyCharm from the desktop. In this step, we will install the GNOME panel and use the same to create a desktop shortcut to execute the PyCharm installed by us in previous steps.
# Refresh Package indexes
sudo apt-get update
# Install GNOME Panel
sudo apt-get install --no-install-recommends gnome-panel
# Create Desktop icon
gnome-desktop-item-edit ~/Desktop/ --create-new
Now configure the PyCharm installation as shown in Fig 3. I have used the PyCharm icon available at the bin directory of the installation.
Click the OK Button to create the desktop icon.
Launch PyCharm
In this step, we will launch the PyCharm using the Desktop Icon created by us in the previous step. We can even execute it using the pycharm.sh file in the bin directory. It asks to import PyCharm settings on the first launch as shown in Fig 4.
We can either import the settings from the existing installation or simply skip it for a fresh install as shown in Fig 4. Now click the OK Button to continue. It asks to accept the Privacy Policy as shown in Fig 5.
Accept the Privacy Agreement and click the Continue Button. The next wizard asks to allow or deny usage statistics as shown in Fig 6.
Click the appropriate button based on your choice. The next wizard provides options to choose the theme as shown in Fig 7.
Choose the Theme and click the Skip Remaining and Set Defaults Button. PyCharm will use default values for the rest of the settings. It shows the Welcome Screen to create the first project as shown in Fig 8.
Hello World
In the previous steps, we have installed PyCharm on Ubuntu and also created the desktop launcher icon. In this step, we will write our first program in Python to print Hello Python on the console. Launch the IDE using the launcher icon available on the desktop. It shows the Welcome Screen having options to either create a new project or choose an existing one as shown in Fig 8.
Now click the Create New Project Button to create our first project. The New Project Wizard provides options to choose the project location and Python interpreter as shown in Fig 9.
Configure the Python Interpreter and click the Create Button to create the HelloWorld project. The IDE creates and opens the HelloWorld project as shown in Fig 10. It will also show the Tips Dialog to keep us updated about the IDE.
Now close the tips dialog, right-click on the project and choose New -> Python File and provide file name as shown in Fig 11 and Fig 12.
Press Enter to create the file. This creates our first Module in Python using PyCharm.
Now right click on the Module or Python File and choose Run Option to execute it. It will execute the module and shows the output as shown in Fig 14.
This is the easiest way to write and execute the Python programs in PyCharm. We can also create the modules using the regular and namespace packages.
Summary
This tutorial provided all the steps to download, install and configure PyCharm on Ubuntu 18.04 LTS. We have also created the first project and the first package to print Hello World on the console. This is all about beginning Python programming using PyCharm. You may join the discussion on installing Eclipse with PyDev on Ubuntu using the comment box.