CUEH Development Environment Guides
Installing Jetbrains IntelliJ IDEA

Installing Jetbrains IntelliJ IDEA

As part of the programming module you study on the course, you are required to interact with the Python programming language. This interaction will be undertaken using an Integrated Development Environment (IDE), which will be installed within the Windows Subsystem for Linux (WSL) environment.

In this guide, you shall be taken through the journey of installing the Jetbrains IntelliJ IDEA IDE and how it will interact with the WSL environment for any module that may make use of the IDE.

Preliminary Information

Before you can begin following this guide, it is expected that you would have already set up and activated your WSL environment. If you are unsure on whether you have completed this process, then visit the guide at the following URL:

Setting up the Windows Subsystem for Linux

Getting a JetBrains Licence

The IDE recommended by this course, is the JetBrains suite of applications. The JetBrains suite is payware, and as such they do not come for free. However, as students at this university, you are able to get a free educational licence. To get your free licence, follow the instructions at the following URL:

JetBrains Educational Licence

Important

You will want to use your Coventry University e-mail address to register for your JetBrains account. It is also crucial you remember the password for this account, as you will need to use these details to activate the IDE and renew your licence every year you are a student.

Downloading and Installing the Jetbrains IntelliJ IDEA IDE

The JetBrains IntelliJ IDEA application is an IDE and is relatively useful for the course you are studying as it provides a means to develop applications (or reports) for a variety of different languages.

Downloading the IDE is relatively straight forward. You can visit the following web page and download the application:

Download JetBrains IntelliJ IDEA

Once you have downloaded the application, follow the on-screen instructions to begin the installation process. Upon successful installation, you will want to tick the box Run IntelliJ IDEA to ensure it is selected. When you click on the Finish button, the IDE will begin to load.

Before the main IDE window is opened, a pop-up will be presented, asking whether you would like to Import IntelliJ IDEA Settings. In this instance, select the option Do not import settings and click on the OK button.

Activation of the IDE

On the first instance of when you are following this guide, and the IDE has been installed and loaded, it will ask for you to activate your software. To do this, you need to click on the Log In to Jetbrains Account... button. This will open an internet browser window, whereby you will need to sign in with your JetBrains account you created earlier.

Once you have logged in to your account, the internet browser will close automatically, and you should now see an Activate button appear. Click on this button and your IDE will be activated.

Installing the Python Plugin

Before you can begin using the IDE for providing solutions for the programming module using the Python programming language, you are required to install a plugin for the IntelliJ IDEA IDE. Once the IDE has loaded, you will be met with a splash screen similar to the one shown in Figure 8. On the splash screen, you will see a button labelled Plugins on the left-hand side of the splash screen, click on this button. The screen will change to present you with a Marketplace of various plugins that can be installed.

On this screen, you can see that the Marketplace tab is active with a blue line underneath the label Marketplace. Directly below this is a search box, and in this box you need to enter the term Python, and a list of options will pop up.

The first option returned should be labelled just Python with the author being JetBrains s.r.o. This is the plugin that is required to be installed, therefore, you can click on the green button labelled Install. This will begin the installation process of the Python plugin for the IDE.

Once it has been successfully installed, you will be met once again with a green button, but this time labelled Restart IDE, click this button and the IDE will be restarted. Once the IDE has restarted, we can begin with the creation of a new Python project.

Creating a Python Project

In this section of the guide, we shall begin the process of creating a new Python project. Once the IDE has loaded, you will be met with a splash screen similar to the one shown in Figure 8. On the splash screen, you will see a button labelled New Project, click on this button. A new window will pop up with a variety of different options.

In this window, you will need to select the New Project option on the left-hand-side. Once this item has been selected, you will then be asked to provide a name of the project and the location where you would like to save the project folder. In this instance, you can all the project My_First_Project and the location can stay as the default location: /home/ian/IdeaProjects.

Note

Notice the underscores in the name of the project? The Linux-based operating system does not like blank spaces in filenames or directory names. As our project will create a new directory, we need to replace the blank spaces with an underscore.

On the same screen, you can see an option to create a Git repository, you can leave this option unchecked. There are also options to select the type of programming language that will be used. If you have installed the Python plugin correctly, an option for Python should be presented. Ensure that this option is selected, as you will be wanting to create a Python project.

With the Python language selected, you will then be met with some additional options to create an Environment. In this instance, you will want to select the New option, and then directly below that you will want to select the Virtualenv environment type. Virtual environments are a great method of keeping your system Python's interpreter separate to any individual projects you are working upon.

Once these settings have been applied, and are similar to the ones shown in Figure 11, you can proceed and click on the Create button. This will begin the process of creating the new Python project.

Connecting WSL to the Project

In the previous section, you would have created a project called My_First_Project. However, this has been created using the Microsoft Windows platform. If you created a virtual environment during this process delete the venv folder that is located inside the projects folder, as you will not require this for the WSL setup. Once the venv folder has been deleted, close the project. You can achieve this by clicking on the four lines in the top-left-hand corner of the IDE. This will automatically open the File menu system, and you can click on the option Close Project.

If this was the only project you had opened, you should be met with the original splash screen of the IntelliJ IDEA IDE. On this splash screen, on the left-hand-side, you will see a button under the section Remote Development which is labelled WSL. Click on this button. This will open a new section on the right-hand-side with an image of the Linux penguin, and below this penguin is a button in blue labelled New Project. Click on this button.

If you have set up WSL correctly on your machine, it should automatically detect your WSL instance. If a WSL instance is not found, then you will need to revisit the guide for setting up WSL on your machine. If there is a WSL instance located, click on the Next button.

In the next section, it will ask you which version of the IDE you want to use. Ensure you select the version that matches the version of the IDE you have installed. Be careful not to select the pre-release option. Below this selection, there is a directory box to select your Project Directory, click on the button at the end of the box with the three dots.

This will open a dialogue window, whereby you need to find the project you created earlier. Typically, it would be located in the user directory of your machine, which can be found in C:\Users\<YOUR_USERNAME>. Inside your user directory will be another folder called IdeaProjects, and located inside this folder will be the project you created earlier. Select the My_First_Project folder name, and then click OK.

Once both fields have been populated, you can click on the Download IDE and Connect button in the bottom-right-hand corner of the splash screen. This will begin downloading the IDE to the WSL instance, and open the project upon its completion.

At this point, you are now able to load your project in the WSL environment, and interact with the WSL terminal environment from within the IDE itself. However, you are not finished just yet.

Creating a Python Virtual Environment

You will notice that things look a little different to earlier. In the opened projects IDE window, you will notice in the top-left-hand corner by the hamburger icon that the name of your WSL instance has appeared. If you click on this, it will show the details about CPU and RAM (memory) usage. If you do not see this, then you have inadvertently opened the project in the Windows IntelliJ IDEA installation.

If you have opened things correctly, then we need to create a virtual environment for the Python interpreter located inside the WSL instance. To do this, you need to click on the Hamburger icon to open the File menu system. Located in this menu is an option called Project Structure. When you click on this option, you will be met with a new dialogue window. Inside this window, you will see the option to assign an SDK to the project, in the form of a drop-down box.

In this drop down box will be the text No Project SDK. If you select this text, a drop-down will appear, and you will be presented with some new options. The most important option is Add Python SDK from Disk. Select this option. A new dialogue window will pop up, and it will ask you whether you want to create a New Environment. This is where you can begin the process of creating a Python virtual environment. You can leave the options as they are already defined, and click on the button labelled OK. This will begin the process of creating the virtual environment.

Installing the Python Plugin

If there is no option to create a Python SDK, then you will need to install the Python plugin for the IDE that is located on the WSL instance. To do this, click on the Hamburger icon to open up the File menu system. Located in this menu is an option labelled Settings. When you select this option, a new dialogue window will open, and you will be able to configure the settings for the IDE.

In this window, you will want to locate the option Plugins (Host) on the left-hand-side. When you click on this window, you will be met with the marketplace. In the tab Marketplace you will want to search for Python and install the plugin.

Conclusion

That is the end of this guide on setting up the JetBrains IntelliJ IDEA IDE. If you have followed all the necessary steps correctly, you should have a fully functional IDE which will enable you to complete any necessary programming-based lab activities you will participate with on this course.

Mistakes or Problems?

If you have spotted any errors or issues within this tutorial, you can e-mail Dr Ian Cornelius. Ensure to include in your message a description of the error or issue and a possible resolution. Also remember to include a URL to the page with the issue or error.