microsoft / microsoft/pxt-microbit

pext/yotta:latest Docker image fails to build the with the latest microbit-v2-samples

Open
#6,467 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cli docker MEF 2026 MEF-medium
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

In PR https://github.com/microsoft/pxt-microbit/pull/6452 I originally updated the microbit-v2-samples repository to the latest tag. This is the error the CI showed:
https://github.com/microsoft/pxt-microbit/actions/runs/16171740734/job/45646848016

Traceback (most recent call last):
  File "build.py", line 144, in <module>
    build(options.clean, verbose=options.verbose, parallelism=options.parallelism)
  File "/home/build/prjclone/utils/python/codal_utils.py", line 16, in build
    use_ninja = shutil.which("ninja") is not None or platform.system() == "Windows"
AttributeError: 'module' object has no attribute 'which'

This is expected if running the python build.py command with Python 2 instead of Python 3, as shutil.which() was added in Python 3.3 released in 2012.

Looking at the invocations in the pxt repo it looks like it's using python instead of python3 and that very likely uses Python 2:
https://github.com/search?q=repo%3Amicrosoft%2Fpxt+build.py&type=code

Some of the options could be to change the pxt invocations to python3 or to install python-is-python3 in the docker images so that python points to the Python 3 installation.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with build.py and utils/python/codal_utils.py, then inspect the pxt build.py invocations and the Docker image configuration mentioned in the issue. Reproduce the CI failure and determine whether the image or invocations should select Python 3; done means the latest microbit-v2-samples build completes successfully in CI.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, python
Domain
build-system, devops
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.