Hello, friends. In this post, you will learn how to install Codon on Ubuntu 22.04. If you are a Python developer, you will find it very useful to know it.
According to the tool’s GitHub site
Codon is a high-performance Python compiler that compiles Python code to native machine code without any runtime overhead.
According to studies by the developers themselves, Codon can be up to 100 times faster than Python (depending on many factors) and can be very useful on very heavy components.
Unlike Python, Codon supports native multithreading, which can lead to speedups many times higher still.
As you can imagine, it has good support for Linux and macOS, but not so much for Windows. So, in almost any Linux distribution, it supports Python.
While it all sounds nice, the developers say “While Codon supports nearly all of Python’s syntax, it is not a drop-in replacement and large codebases might require modifications to be run through the Codon compiler.”
So let’s install it.
Install Codon on Ubuntu 22.04
As you might expect, Codon is not available in the official Ubuntu repositories, but you can always install it, thanks to an official installation script that makes it all easy.
First, open a terminal and update the whole system.
sudo apt update
sudo apt upgrade
Now the next step is to make sure you have curl on your system.
sudo apt install curl
Then, you can run this command to download and install Codon on your system.
/bin/bash -c "$(curl -fsSL https://exaloop.io/install.sh)"
And this will start the entire process. It would be best to add the installation directory to the system PATH so that there is no problem using codon.
To achieve this, you have to edit the
.bashrc file and add this line at the end of the file
user with the name of your user; otherwise it will not work.
Save the changes and close the editor. To apply the changes, just run.
And you are done.
Verify if the command is already usable, for example, check the version
The next step is to test it with real Python code because Codon is correctly installed.
Codon is an ideal tool for Python programmers looking for performance and is largely compatible with each other.