How to install Codon on Ubuntu 22.04 – High-performance Python compiler

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

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.

Introducing Codon

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)"
Install Codon on Ubuntu 22.04
Install Codon on Ubuntu 22.04

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

export PATH=/home/user/.codon/bin:$PATH

Replace 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.

source .bashrc

And you are done.

Verify if the command is already usable, for example, check the version

codon --version

Sample output:

0.16.0

The next step is to test it with real Python code because Codon is correctly installed.

Conclusion

Codon is an ideal tool for Python programmers looking for performance and is largely compatible with each other.

Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"
Angelo
Angelo
I am Angelo. A systems engineer passionate about Linux and all open-source software. Although here I'm just another member of the family.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest articles

Join us on Facebook