Skip to content

Building zephyr projects fails with python 12 #5143

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

Closed
baschi29 opened this issue Apr 30, 2025 · 1 comment
Closed

Building zephyr projects fails with python 12 #5143

baschi29 opened this issue Apr 30, 2025 · 1 comment

Comments

@baschi29
Copy link

baschi29 commented Apr 30, 2025

As mentioned in the title the build fails on a fresh platformio install (trough vscode). I did not save the error message, but the problem was with importing distutils.

The python 12 release notes state:

gh-95299: Do not pre-install setuptools in virtual environments created with venv. This means that distutils, setuptools, pkg_resources, and easy_install will no longer available by default; to access these run pip install setuptools in the activated virtual environment.

Following https://stackoverflow.com/questions/69919970/no-module-named-distutils-util-but-distutils-is-installed I manually added setuptools to the virtual environment which fixed the problem.

I think the solution therefore would probably be to add setuptools accordingly as a dependency in https://github.com/platformio/platformio-core/blob/develop/platformio/dependencies.py for python versions >=12.

I did not include a PR together with this issue yet, as the migration advice as listed under https://peps.python.org/pep-0632/#migration-advice states that for some used modules/types from distutils other modules than setuptools are preferable and I do not have the code insight into this project to judge that.

I did only try building zephyr projects, so maybe this issue belongs to them - again I have not enough insight to judge that.

When I have more time I will try to reproduce the issue again.

@baschi29
Copy link
Author

baschi29 commented May 2, 2025

Error occurs in zephyr framework script, I will therefore close this issue. The problem was that the board I used is not supported by more recent zephyr versions.

Error message:

Traceback (most recent call last):
  File "/home/basti/.platformio/packages/framework-zephyr/scripts/gen_handles.py", line 34, in <module>
    from distutils.version import LooseVersion
ModuleNotFoundError: No module named 'distutils'```

@baschi29 baschi29 closed this as completed May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant