Htm.core on RaspberryPi4 + 64 bit Ubuntu 18.04.4 LTS

Hello, everyone.

Thanks to @Paul_Lamb’s post, I was able to install NuPIC on my RaspberryPi4.

I want to use the HTM system in Python3. So, I installed htm.core on my RaspberryPi4.


This post is how to install htm.core on RaspberryPi4.

Preinstalled Image Download and Burn

To use the full 64Bit Ubuntu with RasberryPi4, this blog post is a good reference.

Download the unofficial 64Bit Ubuntu18.04 image from this link.

Burn the .img file using your favorite program. I use BalenaEtcher. I burned it to a 32GB SD card.

You can use almost all of the features in UbuntuDesktop.But you can’t connect to Ethanet Network, refer to this blog post and add the following file.

$ cd /etc/NetworkManager/conf.d

$ sudo touch 10-globally-managed-devices.conf

$ sudo service network-manager restart

Install htm.core

Clone and install the official repository. htm-community/htm.core

the environment variables for ARM64

Define the environment variables for ARM64.


Define the environment variable export ARCHFLAGS="-arch arm64" in .bashrcfile.

export ARCHFLAGS="-arch arm64"

And then reboot after the update.

$ sudo apt update

$ sudo reboot

Installing cmake with PyPI

If you don’t use cmake in python3, you will get an error.

sudo python3 -m pip install cmake>=3.10 installation error.

sudo apt install python3-cmake build error.

See the stackoverflow post to install scikit-build before installing cmake.

$ sudo pip3 install scikit-build

$ sudo pip3 install cmake

install time about 40min. :coffee:

Installing C++ compiler

Install clang as a C++ compiler. (g++ is already installed.)

$ sudo apt install clang

Python build

You will build htm.core using Python3. To reduce memory consumption of RaspberryPi4, build it over an ssh connection instead of a desktop environment.

$ cd ~

$ git clone

$ cd htm.core

$ sudo python3 install

build & make & install time about 1H. :coffee:

Once you have htm.core installed, test it out. (Install numpy, etc., before testing.)

$ python3

>>> import htm

>>> import htm.bindings

>>> exit()

$ sudo pip3 install mock

$ sudo pip3 install hexy

$ sudo pip3 install numpy

$ sudo python3 test

Install matplotlib

Install matplotlib to run the examples.

sudo apt install python3-matplotlib installation error.

$ sudo apt install libfreetype6-dev pkg-config

$ sudo pip3 install matplotlib

ARM64 program execution speed

I compared the speed at which a desktop PC and Raspberrypi4 run

  • Intel Core i5-8400 (Ubuntu18.04)


  • Arm Cortex-A72 ARMv8 64bit (Ubuntu18.04)


Thank you to everyone in the community.

Translated with (free version)