uflash command not found

In this troubleshooting guide we learn how to fix uflash command not found error message

Introduction

When you run more command in linux terminal / console, you get the following error message

uflash: command not found

or when using sudo you get the following error message

sudo: uflash: command not found

Solutions to uflash: command not found

How To Fix uflash: command not found in Ubuntu / Debian / Kali Linux / Raspbian

In Ubuntu uflash is provided by python3-uflash package.

python3-uflash is:

uflash is a utility for flashing the BBC micro:bit with Python scripts and the MicroPython runtime.

It provides two services:

  • a library of functions to programmatically create a hex file and flash it onto a BBC micro:bit.
  • a command line utility (uflash) that will flash Python scripts onto a BBC micro:bit

Several essential operations are implemented:

  • encode Python into the hex format
  • embed the resulting hexified Python into the MicroPython runtime hex
  • extract an encoded Python script from a MicroPython hex file
  • discover the connected micro:bit
  • copy the resulting hex onto the micro:bit, thus flashing the device
  • specify the MicroPython runtime hex in which to embed your Python code

By default, python3-uflash uses the MicroPython runtime for micro:bit provided by the firmware-microbit-micropython package and which is located at /usr/share/firmware-microbit-micropython/firmware.hex.

This package provides the Python 3 module.

To fix this problem, we can install more using the command below.

sudo apt-get -y install python3-uflash

This command might take some time to finish depending on your machine internet connection.

You can also use apt command to install python3-uflash.

sudo apt -y install python3-uflash

Or if you have aptitude installed you can use the following command.

sudo aptitude install python3-uflash

Summary

In this tutorial we learn how to fix uflash command not found error in Ubuntu / Debian / Kali Linux or Raspbian distribution.