connectedhomeip: Pigweed code breaks with python 3.10
Problem
- Expected - Python 3 update would be handled seamlessly
- Actual - See screenshot
- Steps - upgrade to Jellyfish try to activate master
- Config - N/A
- screenshots, images, logs, etc.

Proposed Solution
Change third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py
# We expect Python 3.8, but if it came from CIPD let it pass anyway.
if ('3.8' not in version and '3.9' not in version
and 'chromium' not in version):
print('=' * 60, file=sys.stderr)
print('Unexpected Python version:', version, file=sys.stderr)
print('=' * 60, file=sys.stderr)
return False
There may be a better way to do this ^^ It doesn’t appear to choose the recognised default version of python for the shell as set by update-alternatives
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 34 (15 by maintainers)
This is possibly unsafe, and not a real fix, since it requires running a binary to override system defaults. System defaults may be IT policy of a given organization
Like @nekleo reported above, this is no longer an issue.
I just verified that I am able to complete
./scripts/bootstrap.shwithout issues on raspberry pi 4 with Ubuntu 22.04, which comes with Python 3.10.If you change the global python version, sure CHIP will build and work, but there are a lot of packages in Ubuntu 22 which assume Python 3.10. By reverting the system Python back to 3.8 you are going to break those other packages. Maybe you don’t use those other packages, but if you do, you are going to end up with something that is hard to debug when they fail to work.
The deadsnakes technique installs 3.9 along side 3.10 so that both are on your system. Then CHIP is adjusted to use the python3.9 install with that small edit posted above.
This should have worked but it doesn’t.
$ export PW_BOOTSTRAP_PYTHON=python3.9Get annoyed at pigweed and simply hard code it:
Then bootstrap will work:
source ./scripts/bootstrap.shDon’t change the python system definition (update-alternatives), it you do that a whole bunch of other packages are going to cease working.
@chadnorvell will do that tomorrow. Thanks for looking into this.
Solution ahead: If Tornadoweb is updated for Python 3.10.x, there should be no reason not supporting 3.10 in pigweed.
However, matters requirements for numpy must be higher than version 1.22.
Using the docker container for development mitigates this problem (VS Code Instructions)