Yes, open source software still has a license…

Someone recently posted to a popular electronics consultant forum:

Great thing about using opensource tools is that there is no problem with licenses, because there are none.

What they were trying to say (and acknowledged afterwards) was that open source software doesn’t require purchasing a license. Open source software still has a license – either a permissive license such as the BSD or MIT license, or a copyleft license such as the GNU GPL.

I’m not making the point to single anyone out or to intentionally be pedantic, it’s a common simplification but overlooks the importance of the license. Without the license it’s unlikely any significant open source software would exist, and clearly we appreciate the existence of open source software.

The open source license limits the liability of the developer (who would willingly be liable for damages if their code didn’t work correctly in a situation that was never anticipated or intended?), and copyleft licenses further prevent creation of closed-source variants, which is a philosophical must for many open source developers.

Open source software has been with us now for over 40 years, the BSD license was first used in 1980, the GNU GPL was first used in 1989 and the Linux kernel was released using the GNU GPL in 1992. At least for me, it’s hard to imagine where software development would be today if we hadn’t have been able to stand on the shoulders of the giants who came before us.

Install PyCharm Community on Linux Mint 21.3

The Linux Mint Software Manager includes the popular Python IDE PyCharm Community, but it’s a Flathub Flatpak and cannot access Python modules installed by Software Manager as System Packages.

For example, after using Software Manager to install Python3 and Python3-tk (System Packages) and PyCharm Community (Flathub Flatpak), try running a simple “Hello, world!” script in PyCharm that opens a Tkinter window:

import tkinter as tk

root = tk.Tk()

w = tk.Label(root, text="Hello, world!")
w.pack()

root.mainloop()

Instead of a Tkinter window appearing, PyCharm shows the error:

ModuleNotFoundError: No module named 'tkinter'

The error is because the execution environment of the PyCharm Flatpak is separate from the main system, where the tkinter module has been installed.

I’m sure there are other solutions and workarounds, but the simplest solution for me was switching to the official tarball release from JetBrains. PyCharm from the JetBrains release will execute in the main system and have access to all the modules installed there.

Download the release .tar.gz archive for Linux from JetBrains (https://www.jetbrains.com/pycharm/download/?section=linux). After it has downloaded, navigate to your ~/Downloads directory using the GUI file manager (Nemo) and double-click the archive to open it in Archive Manager. Drag the “pycharm-community-yyyy-x.y” folder from Archive Manager to a convenient location where PyCharm will be executed from (I put the folder in my home directory, aka ~ aka /home/username/).

As described in the Install-Linux-tar.txt file in the archive, PyCharm is executed using the bin/pycharm.sh shell script. The first time PyCharm is executed it will create configuration files stored in ~/.config/JetBrains/… (the Install-Linux-tar.txt file has more details).

For convenience, I added the path to pycharm.sh to my bash shell path so I can execute PyCharm from a terminal session without having to remember the full path. To do this, I added the following line to the end of ~/.bashrc:

export PATH="$HOME/bin:$HOME/pycharm-community-2023.3.3/bin:$PATH"

I also added a menu entry for PyCharm to the Programming folder in the Linux Mint menu for convenient desktop access.

To do this, right-click on the Linux Mint menu button and select Configure, then Menu, Open the menu editor, Programming folder and finally New Item. Click the Browse button and browse to pycharm.sh to create the command line, enter a Name (and if you wish a comment), click the icon box and search for a PyCharm logo, leave the “Launch in terminal” box unchecked, and finally click OK to close the menu editor. For more detailed instructions, search the web for adding a launcher to the Linux Mint menu.

Now PyCharm has no trouble opening a Tkinter window.