-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pigweed code breaks with python 3.10 #16664
Comments
This seems to be the relevant upstream issue. |
I faced the same problem when I moved to Ubuntu 22.04 LTS. For the time being I got it to work using these commands |
@brosahay |
Hey, |
@brosahay |
Hey, you can try these commands and sharing the output git reset --hard
git clean -dfx
git submodule update
git status This will give you the idea if the repo is clean and reset to the HEAD, since `python --version' is working, my best guess would be that the enviroment is stuck at python 3.10.4. If everything fails recloning the repo could work, or using the docker images, but I know its a lot of data :( |
Hey everyone, I'm on the Pigweed team and I'm looking into this. You shouldn't have any issues bootstrapping the project with a system Python version 3.10. I've tested that myself successfully. This section of code in
... isn't constraining the versions of your system Python, but rather the version of Python that is vendored in the Pigweed environment. In upstream Pigweed, that's defined here. We expect to pull down Python 3.9 for the Pigweed environment, or 3.8 for ARM64 Macs. Matter overrides that for some platforms here, but that still points to 3.9. So while I also want to fully support the use of Python 3.10 in the Pigweed environment, at the moment I'm curious about why your bootstrapping script is either using your system Python 3.10 or pulling Python 3.10 from CIPD. To that end, could you apply this patch to
... and try bootstrapping again after removing your |
@chadnorvell will do that tomorrow. Thanks for looking into this. |
@chadnorvell here you go:
|
@chadnorvell UPDATE: |
The issue appears to be that bootstrap is using your system Python instead of the one vendored in the Pigweed environment. After the bootstrap is finished, do you have a |
@chadnorvell |
In conclusion, before bootstrap follow this steps:
|
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 |
Also this may interfere with your package managers assumptions about your environment. |
@chadnorvell were you able to find out the reason pigweed bootstrap is not working as expected ? |
@tcarmelveilleux @vringar |
Using the docker container for development mitigates this problem (VS Code Instructions) |
This should have worked but it doesn't. Get annoyed at pigweed and simply hard code it:
Then bootstrap will work: Don't change the python system definition (update-alternatives), it you do that a whole bunch of other packages are going to cease working. |
Tested @jonsmirl's solution on Ubuntu 22.04 (Raspberry Pi) and it works well. Without installing python3.9 and editing install.py, active.sh still fails with the python3.10 message. |
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. |
Hi, I had the same problem on my Ubuntu 22.04 box. I found a neat solution to download and configure Python 3.8 using [pyenv] (https://github.com/pyenv/pyenv), and it works perfectly. I'm writing this in the hopes that someone will find it useful. |
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. |
@jonsmirl I use pyenv to override the Python version only in the current shell, but I agree, even in this case, it can lead to bad things. |
In one sense, the use of pyenv (or any virtualenv) is the correct approach for locking a dependency like this: if a program specifically is asking for python3.9, then just replacing it with 3.10 is not necessarily the right thing to do. In this case it seems to work fine though. But this project already uses virtualenv I believe, so I think the best approach here would be to configure that original existing virtualenv to install the correct version of Python that it wants to use? The issue I had was the guide I was following (in the official documentation I think) said to use a specific version of Ubuntu. However, that version was not an LTS release and is no longer available. So I went to the next LTS release after the one that was recommended, which was 22.04, which ships with Python 3.10 now, and hence the problem :) |
"Overrides" - yes. BUT: Linux is missing as an overridden platform in matter and since there is no Inheritance, the system python version is used (no python version restriction for the venv anymore). |
Ok. Here is a solution for all the folks who do not want to use those fine docker images, which works at least for me (Ubuntu 22.04 LTS):
|
@cduvenhorst , using docker sounds good! I didn't even know that was really an option. Should the building guide be updated to say this is the preferred method? https://github.com/project-chip/connectedhomeip/blob/master/docs/guides/BUILDING.md |
I don't think devs should be forced to use docker to build the tree locally. Is there a way to have bootstrap support python 3.10 being the version on the host system? Put another way, can pigweed bootstrap be made flexible enough to minimally install a well-known python version into .environment in a fairly cross-platform / toolchain-independent way and switch over to using that for the remainder of the bootstrap? Also, it would be more useful for the patch above to be constructed in such a way that it allows a dev to recover their existing matter tree which is already cloned from github locally. The impact of this type of breakage is that it stops productivity of devs who have a working tree and toolchain with multiple branches of work-in-progress when they rebase to the latest version of master. Ideally the pigweed toolchain bootstrap would seamlessly upgrade in such cases rather than requiring a fresh clone or deletion of |
For my environment, I was able to restore it by reverting this pigweed commit and adding 3.10 to the acceptlist, e.g. |
Bug: project-chip/connectedhomeip#16664 Change-Id: I6ea98e40269f357f2ce16e39bc21b9a294cfb1c8 Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/93722 Commit-Queue: Auto-Submit <[email protected]> Pigweed-Auto-Submit: Rob Mohr <[email protected]> Reviewed-by: Anthony DiGirolamo <[email protected]>
Yes, bootstrap seems to be using system Python. #20158 will allow 3.10 to work, but seems that it'd be best if the bootstrap could use the python installed by pigweed. After bootstrap is finished, I have a CPU=x86_64
|
Like @nekleo reported above, this is no longer an issue. I just verified that I am able to complete |
This can be closed, verified no longer an issue. |
Closing per above comment. |
Problem
Proposed Solution
Change
third_party/pigweed/repo/pw_env_setup/py/pw_env_setup/virtualenv_setup/install.py
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
The text was updated successfully, but these errors were encountered: