How to Install PyCharm on Ubuntu 24.04, 22.04 or 20.04

PyCharm is a popular Integrated Development Environment (IDE) developed by JetBrains, tailored for Python development. It offers a wide range of features such as intelligent code completion, error checking, debugging, and support for web development frameworks, making it an indispensable tool for both beginners and professional developers. PyCharm is available in both a free Community Edition and a paid Professional Edition with advanced features.

On Ubuntu 24.04, 22.04, or 20.04, PyCharm can be installed using several methods. The first method involves using the Jonas Groeger APT JetBrains PPA, which provides an easy way to install and keep PyCharm updated. Alternatively, you can install PyCharm via Snap through Snapcraft, or as a Flatpak from Flathub, both of which offer sandboxed environments and ensure you have access to the latest versions. This guide will cover all three methods, allowing you to choose the one that best fits your development environment.

Method 1: Install PyCharm via APT PPA

Update Ubuntu System Before PyCharm Installation

Before we begin, updating your Ubuntu system’s local package database is essential. This allows your system to gather the most recent information about the available packages and their versions from Ubuntu’s repositories.

The following command will accomplish this:

sudo apt update

With the package database updated, we should now upgrade the system. This operation ensures all installed software packages on your system are updated to their latest versions:

sudo apt upgrade

Install Initial Packages For PyCharm PPA

Next, we install the necessary packages for our operation, which include dirmngr, ca-certificates, software-properties-common, apt-transport-https, curl, and lsb-release. These tools facilitate the addition and management of repositories, file transfers, and execution of various other tasks:

sudo apt install dirmngr ca-certificates software-properties-common apt-transport-https curl lsb-release -y

Import JetBrains PPA by Jonas Groeger for PyCharm

At this point, we’re ready to add the JetBrains Personal Package Archive (PPA) to our system’s list of repositories. This allows APT to access PyCharm from the JetBrains’ PPA directly.

To ensure the authenticity of the packages from the JetBrains repository, we import the GPG key. GPG, short for GNU Privacy Guard, is an open standard tool used for secure communication. Importing the GPG key ensures that JetBrains genuinely provides the packages we’re getting from the repository:

curl -s https://s3.eu-central-1.amazonaws.com/jetbrains-ppa/0xA6E8698A.pub.asc | gpg --dearmor | sudo tee /usr/share/keyrings/jetbrains-ppa-archive-keyring.gpg > /dev/null

With the GPG key imported, we’re set to add the JetBrains PPA to our system’s list of package sources:

echo "deb [signed-by=/usr/share/keyrings/jetbrains-ppa-archive-keyring.gpg] http://jetbrains-ppa.s3-website.eu-central-1.amazonaws.com any main" | sudo tee /etc/apt/sources.list.d/jetbrains-ppa.list > /dev/null

Refresh APT Packages Index for PyCharm

Having added a new repository, we must update our APT package database once more to fetch the package information from the newly added JetBrains PPA:

sudo apt update

Install PyCharm on via APT Command

With our system ready and all the prerequisites in place, we can now install PyCharm. This particular PPA offers three options: PyCharm Community, Education, and Professional editions.

Most users opt for the Community edition as it’s free. However, while paid, the Education and Professional editions offer more features. Choose the edition that suits your needs and use the corresponding command below to install it:

sudo apt install pycharm-community
sudo apt install pycharm-education
sudo apt install pycharm-professional

With that, you’ve successfully installed PyCharm on your Ubuntu system using the PPA APT method.

Next, alternative Snap or Flatpak methods may better suit your preference and will be featured in two separate sections.

Method 2: Install PyCharm via Snapd

The Snap package manager is a robust alternative for installing PyCharm IDE. It offers the convenience of providing the most recent versions of all three PyCharm editions: Community, Professional, and Educational.

Re-install Snapcraft (If Necessary)

For users who may have uninstalled Snapcraft previously, a reinstallation is required. This is accomplished with the following command:

sudo apt install snapd -y

After successful reinstallation, it’s time to kickstart the snapd service and set it to start automatically whenever your system boots up:

sudo systemctl enable snapd --now

Enable Classic Snap Support

Some Snap packages utilize a classic’ mode, which grants the application more permissions on the host system. To support such packages, a symbolic link needs to be created using the following command:

sudo ln -s /var/lib/snapd/snap /snap

Install Snap Core Files

At this juncture, users who have re-installed Snapcraft or have already installed it need to update the core files to their latest versions. Use the command below to ensure everything is up-to-date:

sudo snap install core

Install PyCharm via Snap Command

With all preparations complete, it’s time to install PyCharm. Choose from the Community, Professional, or Educational editions based on your needs. The Community edition is free and generally suffices for most users. Here are the respective commands for each version:

sudo snap install pycharm-community --classic
sudo snap install pycharm-professional --classic
sudo snap install pycharm-educational --classic

Method 3: Install PyCharm via Flatpak and Flathub

Flatpak, a potent package manager, provides another avenue for installing PyCharm IDE. While not pre-installed by default due to its competition with Snaps, it’s widely adopted and arguably more mature in other Linux distributions.

Note: If your system does not already have Flatpak installed, please follow our comprehensive guide on “How to Install Flatpak on Ubuntu” to get the most recent supported version.

Enable Flathub for PyCharm

Our first action is to enable Flathub, a sizable app store with a collection of Flatpak applications. This action can be executed using the following command:

sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo

With this command, you’re essentially adding the Flathub repository to your Flatpak setup. If the Flathub repository is already present, the –if-not-exists option prevents the command from returning an error.

Install PyCharm via Flatpak Command

Flathub currently supports the Community and Professional editions of PyCharm; select the option you wish to install with one of the following commands:

flatpak install flathub com.jetbrains.PyCharm-Community -y
flatpak install flathub com.jetbrains.PyCharm-Professional -y

Launching PyCharm Post-Installation via GUI or CLI

Command-Line Interface (CLI) Method for PyCharm

APT Launch Commands

To initiate the different versions of PyCharm that have been installed via the APT package manager, use these commands:

pycharm-community
pycharm-professional
pycharm-education

Snap Launch Commands

If you’ve installed PyCharm through the Snap package manager, you’ll want to use the following commands to launch:

snap run pycharm-community
snap run pycharm-professional
snap run pycharm-educational

Flatpak Launch Commands

For those who have installed PyCharm via Flatpak, use these commands:

flatpak run com.jetbrains.PyCharm-Community
flatpak run com.jetbrains.PyCharm-Professional

GUI Method for PyCharm

While the command-line interface can be a swift method to start PyCharm, it might not always be the most practical. You can also launch PyCharm using your system’s graphical user interface (GUI).

  • Access the Activities overview of your desktop.
  • Proceed to Show Applications.
  • Search for PyCharm, and pick the specific version you’ve installed.

Additional PyCharm Commands

Update PyCharm

Staying updated with the latest version of PyCharm is a good practice as it brings new features, improvements, and bug fixes. The update command will differ depending on the third-party package manager you chose for installing PyCharm.

APT Package Manager Update Method for PyCharm

In case you used APT for installation, type in the following commands into your terminal:

sudo apt update
sudo apt upgrade

These commands will check for updates for PyCharm and all other applications installed using APT.

Flatpak Package Manager Update Method for PyCharm

For Flatpak users, updating is straightforward. Run the following command:

sudo flatpak update

Snap Package Manager Update Method for PyCharm

For those who installed PyCharm through Snap, use this command to perform an update:

sudo snap refresh

Remove PyCharm

There might be instances where you no longer need PyCharm on your system. In such cases, you can uninstall it using the corresponding commands for your installation method.

APT Package Manager Remove Method for PyCharm

If you installed PyCharm using APT, you can uninstall it by entering the following commands in your terminal that match the version you installed:

sudo apt remove pycharm-community
sudo apt remove pycharm-professional
sudo apt remove pycharm-education

Moreover, if you do not plan on re-installing PyCharm or using the JetBrains PPA for other products, you can remove the repository and GPG key with these commands:

sudo rm /etc/apt/sources.list.d/jetbrains-ppa.list
sudo rm /usr/share/keyrings/jetbrains-ppa-archive-keyring.gpg

Flatpak Package Manager Remove Method for PyCharm

If you installed PyCharm via Flatpak, use the following commands to uninstall:

flatpak uninstall --delete-data com.jetbrains.PyCharm-Community
flatpak uninstall --delete-data com.jetbrains.PyCharm-Professional

Snap Package Manager Remove Method for PyCharm

If your installation method was Snap, you can use the following commands to remove PyCharm:

sudo snap remove pycharm-community
sudo snap remove pycharm-professional
sudo snap remove pycharm-educational

Conclusion

By installing PyCharm on your Ubuntu system using one of these methods, you gain access to a powerful and versatile IDE for Python development. Whether you choose the convenience of the Jonas Groeger APT JetBrains PPA, the flexibility of Snap, or the security of Flatpak, each method ensures that you have the latest features and updates from JetBrains. Regular updates through these channels will keep your PyCharm installation current, enabling you to leverage the full capabilities of this robust development tool on Ubuntu.

Leave a Comment