Title: Bug Report: NumPy Build Failure on Python 3.12 Due to Missing `distutils` · Issue #19 · codellm-devkit/codeanalyzer-python · GitHub
Open Graph Title: Bug Report: NumPy Build Failure on Python 3.12 Due to Missing `distutils` · Issue #19 · codellm-devkit/codeanalyzer-python
X Title: Bug Report: NumPy Build Failure on Python 3.12 Due to Missing `distutils` · Issue #19 · codellm-devkit/codeanalyzer-python
Description: Summary Installation fails on Python 3.12.5 when trying to build numpy==1.23.5 due to the removal of distutils from the Python standard library in Python 3.12. The package manager attempts to build an older version of NumPy that depends ...
Open Graph Description: Summary Installation fails on Python 3.12.5 when trying to build numpy==1.23.5 due to the removal of distutils from the Python standard library in Python 3.12. The package manager attempts to build...
X Description: Summary Installation fails on Python 3.12.5 when trying to build numpy==1.23.5 due to the removal of distutils from the Python standard library in Python 3.12. The package manager attempts to build...
Opengraph URL: https://github.com/codellm-devkit/codeanalyzer-python/issues/19
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Bug Report: NumPy Build Failure on Python 3.12 Due to Missing `distutils`","articleBody":"## Summary\nInstallation fails on Python 3.12.5 when trying to build `numpy==1.23.5` due to the removal of `distutils` from the Python standard library in Python 3.12. The package manager attempts to build an older version of NumPy that depends on `distutils`, which is no longer available.\n\n## Environment\n- **Python Version**: CPython 3.12.5\n- **Operating System**: macOS (using pyenv)\n- **Package Manager**: uv\n- **Project Version**: codeanalyzer-python v0.1.10\n\n## Error Details\n```\n× Failed to build `numpy==1.23.5`\n├─▶ The build backend returned an error\n╰─▶ Call to `setuptools.build_meta:__legacy__.build_wheel` failed (exit status: 1)\n\n [stderr]\n Traceback (most recent call last):\n File \"\u003cstring\u003e\", line 8, in \u003cmodule\u003e\n File \"/Users/sinhas/.cache/uv/builds-v0/.tmp0bq7uK/lib/python3.12/site-packages/setuptools/__init__.py\", line 10, in \u003cmodule\u003e\n import distutils.core\n ModuleNotFoundError: No module named 'distutils'\n\n hint: `distutils` was removed from the standard library in Python 3.12. Consider adding a constraint (like `numpy \u003e1.23.5`) to avoid building a version of `numpy` that depends on `distutils`.\nhelp: `numpy` (v1.23.5) was included because `codeanalyzer-python` (v0.1.10) depends on `numpy`\n```\n\n## Root Cause\nThe current dependency specification in pyproject.toml allows NumPy versions that are incompatible with Python 3.12:\n\n```toml\n# Current specification\n\"numpy\u003e=1.21.0,\u003c1.24.0; python_version \u003c '3.11'\",\n\"numpy\u003e=1.24.0,\u003c2.0.0; python_version \u003e= '3.11'\",\n```\n\nThe issue is that Python 3.12 falls under the `python_version \u003e= '3.11'` condition, but NumPy versions `1.24.0` and below still depend on `distutils`, which was removed in Python 3.12.\n\n## Proposed Solution\nUpdate the NumPy dependency constraints in pyproject.toml to handle Python 3.12 specifically:\n\n```toml\n# Updated specification\n\"numpy\u003e=1.21.0,\u003c1.24.0; python_version \u003c '3.11'\",\n\"numpy\u003e=1.24.0,\u003c2.0.0; python_version \u003e= '3.11' and python_version \u003c '3.12'\",\n\"numpy\u003e=1.26.0,\u003c2.0.0; python_version \u003e= '3.12'\",\n```\n\n## Alternative Solutions\n1. **Pin to a specific NumPy version**: Use `numpy\u003e=1.26.0` for Python 3.12+ since NumPy 1.26.0+ officially supports Python 3.12\n2. **Add upper bound for Python version**: Consider adding `python_version \u003c '3.12'` to the existing constraint\n3. **Install distutils separately**: Add `setuptools` as a dependency, though this is not recommended as a long-term solution\n\n## Steps to Reproduce\n1. Use Python 3.12.5\n2. Clone the repository\n3. Run `uv sync` or similar package installation command\n4. Observe the NumPy build failure\n\n## Impact\n- Prevents installation on Python 3.12\n- Affects users trying to use the latest Python version\n- May affect CI/CD pipelines running on Python 3.12\n\n## References\n- [NumPy Python 3.12 Support](https://numpy.org/doc/stable/release/1.26.0-notes.html)\n- [PEP 632: Deprecate distutils module](https://peps.python.org/pep-0632/)\n- [Python 3.12 What's New - Removed Modules](https://docs.python.org/3.12/whatsnew/3.12.html#removed)","author":{"url":"https://github.com/rahlk","@type":"Person","name":"rahlk"},"datePublished":"2025-07-21T18:43:54.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/19/codeanalyzer-python/issues/19"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:3337aeda-b656-e04f-21e7-8a356a271a5a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 83F4:12A110:8BDE3D:BBD69A:698E3CE3 |
| html-safe-nonce | 2cee985acbeb9a083660eda8e30f47796baa9ab66e808ba9b3324fb64acae545 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4M0Y0OjEyQTExMDo4QkRFM0Q6QkJENjlBOjY5OEUzQ0UzIiwidmlzaXRvcl9pZCI6IjI5MzQ4NDAzODczNjgyNzEwNzUiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | b7f285fd200e18a9c114a2226265e8931e546ebcef87463af471587675725750 |
| hovercard-subject-tag | issue:3249665806 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/codellm-devkit/codeanalyzer-python/19/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c80223e526b486bd0058d1bff01745f5c07e5e7c00609f6dc1f40744bc6bb33e/codellm-devkit/codeanalyzer-python/issues/19 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c80223e526b486bd0058d1bff01745f5c07e5e7c00609f6dc1f40744bc6bb33e/codellm-devkit/codeanalyzer-python/issues/19 |
| og:image:alt | Summary Installation fails on Python 3.12.5 when trying to build numpy==1.23.5 due to the removal of distutils from the Python standard library in Python 3.12. The package manager attempts to build... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | rahlk |
| hostname | github.com |
| expected-hostname | github.com |
| None | a5632af64f7fed7bff1d6a428d1aca1b94fa7a48f760de2d39d9b1effdbf0082 |
| turbo-cache-control | no-preview |
| go-import | github.com/codellm-devkit/codeanalyzer-python git https://github.com/codellm-devkit/codeanalyzer-python.git |
| octolytics-dimension-user_id | 197800760 |
| octolytics-dimension-user_login | codellm-devkit |
| octolytics-dimension-repository_id | 978344904 |
| octolytics-dimension-repository_nwo | codellm-devkit/codeanalyzer-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 978344904 |
| octolytics-dimension-repository_network_root_nwo | codellm-devkit/codeanalyzer-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | aa1fa9100f85cd8b602c63c7e337f9151e70024f |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width