Installing Pycharm on Linux

Installing Pycharm on Linux

An elegant Python IDE

ยท

3 min read

There are two ways to Download and install pycharm on Linux. They are as follows:

  • Using snap

      sudo snap install pycharm-community --classic  \\For free version 
      sudo snap install pycharm-professional --classic \\For paid version
    
  • Manual installation

NOTE :
I personally do not use snap. Thus, I did not take the easy way of installing pycharm with snap. Instead, I took the manual way which isn't difficult, but it covers some very essential things about linux one must know. If you have installed other packages manually before, this is a cake-walk for you, otherwise - a good learning treat from me ๐Ÿ˜‰


Manual Installation (applies to all distros)

  1. Downloading Pycharm from official source

    1. Download the official tar.gz package for Linux from JetBrains official website. At the time of writing, the download page was maintained at https://www.jetbrains.com/pycharm/download/?section=linux

    2. If you do not have a license and wish to use Pycharm for free, download the latest COMMUNITY version. With the community version, you will be only able to work with Python and no other language is supported. However, if you have access to the paid version, you can do web-development and database related things as well.

    3. I have downloaded the community version.

  2. Extracting the tarball

    • Extract the tarball into an auto-created directory with the same name as that of the tar.gz file.

        tar -xvzf pycharm-community-*.tar.gz
      

      Tar command flags :

      • x : Extract the tar file

      • v : Verbose mode - prints on screen the logs (information)

      • z : Use gzip (since the downloaded file is a tar.gz file)

      • f : specify input file

    • Now, a folder with the name pycharm-community-* will be created in the same folder where you downloaded the tarball.

    • Move this folder to the /opt folder as follows :

        sudo mv pycharm-community-* /opt/
      
    • We require sudo permissions because /opt is a protected folder by default.

    • Why move it to the /opt folder and not any other?

      • As an answer to this, the Linux Filesystem Hierarchy has reserved the /opt folder for all the software and add-on packages that are not a part of the default installation.
  3. Creating a soft-link to the executable :

    • The actual executable file is located in the pycharm-community-*/bin/ folder. The name of the executable is pycharm.sh.

    • At present, we can run pycharm, but we'll require sudo permissions to do so every time and that too with the full path like this sudo sh /opt/pycharm-community-*/bin/pycharm.sh. However, this is cumbersome.

    • Thus, a common workaround to this is to create a softlink to this executable file and place that link in a folder in the $PATH variable.

         sudo ln -s /opt/pycharm-community-*/bin/pycharm.sh pycharm
      
    • Here, I am keeping the name of the link as pycharm. To verify if the softlink has been created, try the following :

        ls -l pycharm
      
    • It must show a symlink like lrwx... ending with pycharm -> /opt/pycharm-community-*/bin/pycharm.sh.

    • Thus, the softlink has been created. We now have to make it accessible from anywhere throughout the system.

    • We move the pycharm link to the /usr/local/bin/ folder for global access.

        sudo mv pycharm /usr/local/bin/
      
    • To verify that pycharm is now globally executable, try the following :

        whereis pycharm
      
    • It must give the following output :

  4. Launch Pycharm

    • You can now launch Pycharm IDE from any terminal window by simply typing pycharm.

NOTE :

If you find any corrections/improvements to the procedure followed, feel free to fill in the comments section.

Happy Learning ;)

ย