It’s considered strange if somebody says they never heard of Python. Still, if you want to know about Python, Python is a general-purpose, versatile, powerful, high-level programming language. Python can be used in both scripting and programming. It’s the most versatile language as it can be used in various landscapes, from small scripts to large complex application developments. It’s the favorite programming and scripting language for cybersecurity professionals either. In the field of AIML, no other languages dominate Python. Python is a different topic of discussion. Let’s leave the Python at this point. Let’s concentrate more on running Python on an IDE like PyCharm on Linux operating system. Before you run a python code on IDE, you will have to install and configure it on your Linux, isn’t it?. Let’s see how to install PyCharm on Linux Mint and Ubuntu and how to create your own project on PyCharm and run a python program.
Table of Contents
What Is An IDE?
Before we jump right into the PyCharm, let’s see what is an IDE is. IDE is short for an Integrated Development Environment. IDT is basically a software environment used to build applications that combine common developer tools into a single interface. IDE is typically composed of several components:
- Intellegent source code editor: It is an advanced text editor, which helps programmers in writing codes with features such as auto-syntax highlighter and auto-completion. These features help programmers identifying the different objects in the program with different coloring systems.
- Local build automation: This component helps programmers in automating simple, repeatable tasks like compiling source code into binary code, packaging binary code, and running automated tests, creating a local build of the software.
- Debugger: Debugger allows to comple the entire program in debug mode and stop/pause the executio whereever the programmer wnats. It helps programmers in finding the location of bugs in the source code.
What Is PyCharm?
PyCharm is one of the most popular IDE for Python. PyCharm is developed by JetBrains (formerly known as IntelliJ), a Czech software company known for making software development tools. PyCharm is a cross-platform IDE tool that works on Windows, Linux, and mac. This tool comes in both community and professional editions. The community edition is made free to use under Apache License. However, the professional edition is its paid version which comes with some additional features.
Benefits of Using PyCharm:
It is not mandatory to have PyCharm write and run Python programs. But, the features PyCharm provides made programmers’ life a lot easier. Pycharm offers a long set of features such as Intelligent Coding Assistance, a collection of built-in developer tools, graphical debugger, Python profiler, support for SQL, Django, and Anaconda.
Pycharm is loaded with a wide set of development tools. In its collection of tools, it has a powerful graphical debugger that helps find the exact location of bugs. It supports most of the popular databases, including Access Oracle, SQL Server, PostgreSQL, MySQL, and others. It’s a great tool for web developers as it supports modern web development frameworks such as Django, Flask, Google App Engine, Pyramid, and web2py.
The professional version of PyCharm can save programmers time by integrating well-known VCS tools like Git, SVN, Mercurial, or other version control systems. The Pro version also comes with a feature that allows programmers to run and debug your application on remote machines.
How to Install PyCharm on Linux Mint and Ubuntu in Three Different Ways?
PyCharm is easy to install application. You can download the community edition of PyCharm and use it for free. Visit this page if you want to download PyCharm for Windows operating system. However, the purpose of writing this post is to show you how to install PyCharm on Linux Mint and Ubuntu. You can install PyCharm in different ways on Linux systems. Let’s see three ways to install PyCharm on Linux Mint and Ubuntu OS.
- Install PyCharm from Snap Store
- Install PyCharm from Software Manager
- Install PyCharm from an Installer File
#1. Install PyCharm From Snap Store
- Enable the snap on Linux Mint.
- Press Ctrl+Alt+t to open the terminal.
- Remove ‘nosnap.pref‘ from the location /etc/apt/preferences.d/nosnap.pref:
- Update the repository.
$ sudo rm /etc/apt/preferences.d/nosnap.pref
$ sudo apt update
2. Install snapd from the command line. Note: you can also install snapd from the Sodtware Manager either. Search ‘snapd’ in the Software Manager.
$ sudo apt install snapd
3. PyCharm is distributed in three editions: Professional Edition, Community Edition, and Edu Edition. Run these commands to install the PyCharm. We are going to install the community edition in this demonstration.
$ sudo snap install pycharm-professional --classic
$ sudo snap install pycharm-community --classic
$ sudo snap install pycharm-educational --classic
4. Use these commands to run Pycharm from the terminal.
Read and accept the terms and data sharing policy.
#2. Install PyCharm From Software Manager
It is possible to install PyCharm directly from the Software Manager. It’s is the easiest way to install. All you need to open the Software Manager and search ‘pycharm’ in the search box. Only two editions: professional and community editions are available on the Software Manager. Select the one which you want. We are installing the community edition like previous.
- Open the Software Manager and type ‘pycharm’ in the search box.
2. Select the one which you want. We are installing the community edition as we did before. Click on the install button in the top right corner. Let the installation process complete. The installation process may take a few minutes depending on your system performance and internet bandwidth.
3. Launch PyCharm after the completion of the installation.
Read and accept the terms and data sharing policy to start PyCharm.
#3. Install PyCharm From an Installer File
- Download the installer from here. You can try downloading using the wget command either.
$ wget https://www.jetbrains.com/pycharm/download/download-thanks.html?platform=linux&code=PCC
2. Downloaded file would be in the ‘Downloads‘ directory. It is recommended to install the package under /opt/ directory. Unpack the tar file using this command.
$ cd Downloads/
$ sudo tar xzf pycharm-*.tar.gz -C /opt/
3. Namivage to the ‘bin‘ inside the PyCharm. Run ‘python.sh‘ file to launch PyCharm.
$ cd /opt/pycharm-community-2021.2.1/bin/
$ sh pycharm.sh
4. Read and accept the terms and data sharing policy to launch the PyCharm on Linux Mint.
How to Configure PyCharm to Run Python Programs?
This is the first window PyCharm greats you with. Start by creating a new project out here. After you click on the New Project. This is the configuration window you will land on. Configurations are self-explanatory. There are three main things you should always decide. That is the location of your new project, environment, and Interpreter.
Create your first python file from File > New > Python File. Name the file of your choice. Hit the ‘Enter‘ key. We have created ‘firstPythonProgram.py’ file.
How to Configure Python Interpreter on Pytharm?
You should have an interpreter configured to run the program. However, most of you will not see the interpreter for the first time. Configure the interpreter from File > Settings >Project (The project you created) > Python Interpreter.
Click the settings icon select ‘Add‘
Configure the interpreters for Virtual Environment and System Interpreter from the dropdown. If you use Anaconda, you can configure the interpreter for Conda either. It is all set to run the python program.
How to Add/Install Python Packages In PyCharm?
You might face problems running your program due to the required packages are not installed. It is quite easy to install the packages on PyCharm.
To add or install packages on PyCharm: File > Settings > Project (The project you created) > Python Interpreter > Add ‘+’ icon.
Search the package you want to install. Select the package and click on ‘Install‘.
You will see a successful message after the installation of the package.
This completes the basic configuration of PyCharm to run the python program.
Thanks for reading the tutorial. Please let us know if you have any difficulties in completing the process.