Last Updated on 19. February 2022 by Victor Karp
This tutorial explains how to run TortoiseHg from source code files and install dependencies on a Debian/Ubuntu based Linux distribution. TortoiseHg is a GUI for the distributed source control management tool Mercurial.
This is useful for distributions like Linux Mint, which does not have TortoiseHg available in the Software Manager and it’s also not possible to install it from a .deb file due to unsatisfiable dependencies.
Installing necessary tools and modules
TortoiseHg needs a couple of files to run from source. If you don’t install them, you’ll get the following errors (depending on what’s missing):
/usr/bin/env: ‘python’: No such file or directory
ImportError: cannot import name 'log' from 'distutils' (/usr/lib/python3.8/distutils/init.py)
ModuleNotFoundError: No module named 'mercurial'
ModuleNotFoundError: No module named 'PyQt5'
ModuleNotFoundError: No module named 'PyQt5.Qsci'
To install them, run the following two commands in a terminal one after another:
sudo apt install python3 python-is-python3 python3-distutils python3-pip python3-iniparse
sudo pip3 install mercurial pyqt5 qscintilla
If you can’t install the python-is-python3 package, you can create the link manually instead like this:
sudo ln -s /usr/bin/python3 /usr/bin/python
What are these commands for? (skip reading if you don’t care)
– python3 is the programming language that TortoiseHg is written in.
– python-is-python3 creates an internal link from ‘python’ to ‘python3’. Without this link, TortoiseHg can’t find your python3 installation.
– python3-iniparse is necessary to edit any setting inside TortoiseHg, including the name you have to enter when you make a commit.
– python3-pip is a tool that is necessary to install the Python modules listed in the second command block.
– mercurial is the source control software that does all the work (TortoiseHg is just a GUI for it).
– pyqt5 is related to TortoiseHg’s window rendering (Qt is used to develop graphical applications).
– qscintilla is related to editing text and code.
Downloading and starting TortoiseHg
When you have installed all dependencies listed above, go to the TortoiseHg source code download page and download the latest version. Extract the archive to any place you like.
Then open a terminal, drag the ‘thg’ file from the extracted archive into it and press Enter. TortoiseHg should start now.
Creating a shortcut for thg or running it from the terminal by typing thg
I recommend creating a desktop or application menu shortcut to the thg file, so you don’t need the terminal to start it. The steps are different depending on your desktop environment. If you are using Linux Mint Cinnamon, read the Application Shortcuts on Linux Mint Cinnamon tutorial.
If you want to start it via the terminal simply by typing ‘thg’ instead, read the tutorial about launching applications from the terminal.
Visit the Linux tutorials main page for more Linux tutorials.