Bug 285957 - lang/python312 as default python
Summary: lang/python312 as default python
Status: In Progress
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: freebsd-python (Nobody)
URL:
Keywords: tracking
Depends on: 285958 286298 286361 285953
Blocks: 287530
  Show dependency treegraph
 
Reported: 2025-04-08 08:31 UTC by Jordan Ostreff
Modified: 2025-06-14 12:21 UTC (History)
6 users (show)

See Also:
vishwin: maintainer-feedback+


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jordan Ostreff 2025-04-08 08:31:31 UTC
I'm following the manual:

 For portmaster users:
  # sh
  # portmaster -o lang/python312 python311
  # REINSTALL="$(pkg info -oq '*py311*’)”
  # pkg delete -f "*py311*"
  # portmaster $REINSTALL
  # REBUILD=$(pkg query -g "%n:%dn" '*' | grep py3 | grep -v py311 | cut -d : -f 1 | sort -u)
  # portmaster $REBUILD
  # REBUILD2=$(pkg list | grep python3-3.11 | xargs pkg which | awk '{print $6}' | sort -u)
  # portmaster $REBUILD2

  Final steps (for pre-built packages & portmaster):

  If no longer required, Python 3.11 can be removed via
  "pkg remove python311" and the directory /usr/local/lib/python3.11 can
  then be deleted afterwards, if not empty.	

and have stopped on step portmaster $REINSTALL

# pkg info | grep py312
py312-build-1.2.2_2            PEP517 package builder
py312-flit-core-3.11.0         Distribution-building parts of Flit
py312-installer-0.7.0          Library for installing Python wheels
py312-packaging-24.2           Core utilities for Python packages
py312-pyproject-hooks-1.2.0    Wrappers to call pyproject.toml-based build backend hooks
py312-wheel-0.45.1             Built-package format for Python

and actually problem is that devel/py-setuptools can't be build

$REINSTALL contains following:
devel/py-Automat devel/py-babel textproc/py-CommonMark devel/py-Jinja2 www/py-paste textproc/py-pyhamcrest print/py-PyMuPDF security/py-SecretStorage security/py-acme www/py-aioquic textproc/py-alabaster devel/py-annotated-types devel/py-appdirs devel/py-asn1crypto devel/py-attrs security/py-authlib mail/py-authres security/py-bcrypt www/py-beaker www/py-beautifulsoup www/py-bleach archivers/py-brotli devel/py-build www/py-cachecontrol devel/py-calver devel/py-canonicaljson security/py-certbot security/py-certbot-apache security/py-certifi devel/py-cffi textproc/py-chardet textproc/py-charset-normalizer devel/py-click devel/py-click-default-group devel/py-configargparse devel/py-configobj devel/py-constantly devel/py-country devel/py-crashtest security/py-cryptography lang/cython devel/py-dbus devel/py-defusedxml devel/py-deprecation devel/py-distlib sysutils/py-distro dns/py-dnspython textproc/py-docutils devel/py-dulwich devel/py-editables textproc/py-elementpath devel/py-entrypoints devel/py-evdev devel/py-fastjsonschema sysutils/py-filelock devel/py-fire devel/py-flit devel/py-flit-core print/py-fonttools devel/py-frozendict filesystems/py-fs2 textproc/py-furo devel/py-future databases/py-gdbm textproc/py-gi-docgen devel/py-google-i18n-address www/py-h2 devel/py-hatch-fancy-pypi-readme devel/py-hatch-nodejs-version devel/py-hatch-vcs devel/py-hatchling www/py-hpack www/py-html5lib www/py-hyperframe www/py-hyperlink dns/py-idna devel/py-ijson graphics/py-imagesize devel/py-immutabledict devel/py-immutables devel/py-importlib-metadata devel/py-importlib-resources devel/py-incremental devel/py-iniconfig devel/py-installer devel/py-intervaltree devel/py-ipython_genutils devel/py-iso8601 devel/py-jaraco.classes devel/py-jeepney devel/py-joblib security/py-josepy devel/py-jsonschema devel/py-jsonschema-specifications devel/py-jupyter-client devel/py-jupyter-core security/py-keyring devel/py-kitchen www/py-lesscpy devel/py-libevdev textproc/py-libxml2 textproc/py-linkify-it-py devel/py-lxml textproc/py-m2r textproc/py-mako textproc/py-markdown textproc/py-markdown-it-py textproc/py-markupsafe devel/py-matrix-common devel/py-maturin textproc/py-mdit-py-plugins textproc/py-mdurl mail/py-milter textproc/py-mistune textproc/py-mistune0 devel/py-mock devel/py-more-itertools devel/py-msgpack devel/py-mypy devel/py-mypy_extensions databases/py-mysqlclient textproc/py-myst-parser devel/py-nbclient devel/py-nbformat net/py-ndg-httpsclient devel/py-nest-asyncio net/py-netaddr devel/py-olefile security/py-openssl devel/py-orjson devel/py-packaging textproc/py-pandocfilters devel/py-parsedatetime devel/py-pathspec devel/py-pbr misc/py-pexpect devel/py-phonenumbers graphics/py-pillow devel/py-pip devel/py-pkgconfig sysutils/py-pkginfo devel/py-platformdirs devel/py-pluggy devel/py-ply devel/py-poetry-core devel/py-poetry-plugin-export www/py-priority1 net-mgmt/py-prometheus-client devel/py-proselint sysutils/py-psutil databases/py-psycopg2 sysutils/py-ptyprocess dns/py-py3dns devel/py-pyasn1 devel/py-pyasn1-modules devel/py-pybind11 devel/py-pycparser devel/py-pydantic devel/py-pydantic-core devel/py-pyflakes textproc/py-pygments www/py-pyjwt textproc/py-pylons-sphinx-themes www/py-pylsqpack security/py-pymacaroons databases/py-pymysql security/py-pynacl textproc/py-pypa-docs-theme devel/py-pyparsing devel/py-pyproject-hooks devel/py-pyrfc3339 devel/py-pyrsistent security/py-pysaml2 comms/py-pyserial net/py-pysocks mail/py-pyspf textproc/py-pystemmer devel/py-pytest devel/py-pytest-runner textproc/py-python-augeas devel/py-python-dateutil textproc/py-python-docs-theme textproc/py-python-docx www/py-python-multipart devel/py-pytz devel/py-pyudev graphics/py-pyvips devel/py-pyyaml net/py-pyzmq graphics/py-qrencode graphics/py-railroad-diagrams devel/py-rapidfuzz-capi textproc/py-recommonmark devel/py-referencing devel/py-repoze.who www/py-requests www/py-requests-toolbelt devel/py-rpds-py devel/py-scikit-build devel/py-semantic-version security/py-service-identity devel/py-setuptools devel/py-setuptools-rust devel/py-setuptools-scm devel/py-setuptools_scm_git_archive devel/py-shellingham security/py-signedjson devel/py-simplejson devel/py-six textproc/py-smartypants textproc/py-snowballstemmer devel/py-sortedcontainers www/py-soupsieve mail/py-spf-engine textproc/py-sphinx textproc/py-sphinx-argparse textproc/py-sphinx-basic-ng textproc/py-sphinx-copybutton textproc/py-sphinx-inline-tabs textproc/py-sphinx-markdown-tables textproc/py-sphinx_press_theme textproc/py-sphinx_rtd_theme textproc/py-sphinxcontrib-applehelp textproc/py-sphinxcontrib-devhelp textproc/py-sphinxcontrib-htmlhelp textproc/py-sphinxcontrib-jsmath textproc/py-sphinxcontrib-qthelp textproc/py-sphinxcontrib-serializinghtml textproc/py-sphinxcontrib-towncrier textproc/py-sphinxcontrib-websupport databases/py-sqlite3 devel/py-termcolor textproc/py-tinycss2 x11-toolkits/py-tkinter textproc/py-toml textproc/py-tomli textproc/py-tomli-w textproc/py-tomlkit www/py-tornado textproc/py-towncrier devel/py-traitlets www/py-treq devel/py-trove-classifiers devel/py-twisted devel/py-types-cryptography devel/py-types-psutil devel/py-types-setuptools devel/py-typing-extensions textproc/py-typogrify textproc/py-uc-micro-py devel/py-unicodedata2 devel/py-unpaddedbase64 net/py-urllib3 devel/py-vcversioner devel/py-versioneer devel/py-virtualenv devel/py-wcwidth converters/py-webencodings www/py-webob devel/py-wheel net/py-wsdd textproc/xml2rfc textproc/py-xmlschema devel/py-zipp devel/py-zope.component devel/py-zope.event devel/py-zope.interface archivers/py-zopfli devel/scons
Comment 1 Vladimir Druzenko freebsd_committer freebsd_triage 2025-04-08 09:27:38 UTC
There is an idea not to deviate too much from "VFX platform": https://vfxplatform.com/
In "VFX platform 2025" Python is 3.11.x.
Comment 2 Jordan Ostreff 2025-04-08 09:32:59 UTC
it looks that keeping level/py-setuptools bellow to 75.8.2 causes some problems - with wheel and not only....
Comment 3 Charlie Li freebsd_committer freebsd_triage 2025-04-08 16:19:26 UTC
What manual is this?

The devel/py-setuptools currently in tree is "temporarily" pinned to devel/py-wheel044 until the update can happen, so you will need to temporarily remove devel/py-wheel so that 044 can be installed, then remove 044 once finished.

In a more general sense however, building Python packages (FreeBSD or not) outside of isolated environments like poudriere or virtual environments is not really supported. While we in FreeBSD strive to have the ability to build stuff on live systems/environments, we are still beholden to the warts of the greater communities of the stuff ported. The Python packaging community (and a couple others) has effectively required them for support purposes as incompatibilities and breakages between even not-quite-major package versions happen often, and different versions cannot be installed concurrently.
Comment 4 Jordan Ostreff 2025-04-08 16:52:41 UTC
Currently with only pyton3-3.12 installed as default and only python version, only following ports doesn't build


databases/py-gdbm@py312 

security/py-keyring@py312 devel/py-jaraco.classes@py312 
security/py-SecretStorage@py312

graphics/py-pillow@py312 x11-toolkits/py-tkinter@py312 devel/py-twisted@py312

www/py-treq

devel/py-repoze.who www/py-webob@py312

x11-toolkits/py-tkinter

net-mgmt/py-prometheus-client devel/py-Automat@py312
Comment 5 jan 2025-04-10 04:47:59 UTC
It's not possible to build databases/py-sqlite3. I think because there is no py312 flavor for setuptools?

===>  Configuring for py312-setuptools-63.1.0_3
===>  Building for py312-setuptools-63.1.0_3
* Getting build dependencies for wheel...
Traceback (most recent call last):
  File "/usr/local/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
    main()
  File "/usr/local/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in main
    json_out["return_val"] = hook(**hook_input["kwargs"])
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 137, in get_requires_for_build_wheel
    backend = _build_backend()
              ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 70, in _build_backend
    obj = import_module(mod_path)
          ^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1310, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 999, in exec_module
  File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
  File "/var/ports/basejail/usr/ports/devel/py-setuptools/work-py312/setuptools-63.1.0/setuptools/__init__.py", line 16, in <module>
    import setuptools.version
  File "/var/ports/basejail/usr/ports/devel/py-setuptools/work-py312/setuptools-63.1.0/setuptools/version.py", line 1, in <module>
    import pkg_resources
  File "/var/ports/basejail/usr/ports/devel/py-setuptools/work-py312/setuptools-63.1.0/pkg_resources/__init__.py", line 2191, in <module>
    register_finder(pkgutil.ImpImporter, find_on_path)
                    ^^^^^^^^^^^^^^^^^^^
AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
*** Error code 1

Stop.
make[1]: stopped in /basejail/usr/ports/devel/py-setuptools
*** Error code 1

Stop.
make: stopped in /basejail/usr/ports/databases/py-sqlite3
Comment 6 commit-hook freebsd_committer freebsd_triage 2025-04-10 13:46:05 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=8927fe8f67e32805fe94c94356b013d59ca4af25

commit 8927fe8f67e32805fe94c94356b013d59ca4af25
Author:     Charlie Li <vishwin@FreeBSD.org>
AuthorDate: 2025-04-10 13:44:00 +0000
Commit:     Charlie Li <vishwin@FreeBSD.org>
CommitDate: 2025-04-10 13:44:00 +0000

    devel/py-setuptools: account for removed pkgutil methods in Python 3.12

    Reported by: jan, Tatsuki Makino
    PR: 285957

 devel/py-setuptools/Makefile | 3 +++
 devel/py-setuptools/distinfo | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)
Comment 7 Charlie Li freebsd_committer freebsd_triage 2025-04-10 13:49:05 UTC
Commandeering this into a meta-bug to track Python 3.12-specific package breakages generally. After 3.13 is committed, activity should intensify when exp-runs happen and whatnot to preserve the n-1 bit (n being latest upstream CPython release).

(In reply to Jordan Ostreff from comment #4)
Try building these again.
Comment 8 Tatsuki Makino 2025-04-11 20:04:58 UTC
Thanks to the fixes in setuptools, the build has progressed quite a bit.
However, this time the build of net/py-pyzmq@py312 will stop due to a famous cause.

The following is an excerpt from the log.

zmq/backend/cython/_version.c:2887:55: error: no member named 'ob_digit' in 'struct _longobject'
            const digit* digits = ((PyLongObject*)x)->ob_digit;
                                  ~~~~~~~~~~~~~~~~~~  ^
zmq/backend/cython/_version.c:2942:55: error: no member named 'ob_digit' in 'struct _longobject'
            const digit* digits = ((PyLongObject*)x)->ob_digit;
                                  ~~~~~~~~~~~~~~~~~~  ^
zmq/backend/cython/_version.c:3083:55: error: no member named 'ob_digit' in 'struct _longobject'
            const digit* digits = ((PyLongObject*)x)->ob_digit;
                                  ~~~~~~~~~~~~~~~~~~  ^
zmq/backend/cython/_version.c:3138:55: error: no member named 'ob_digit' in 'struct _longobject'
            const digit* digits = ((PyLongObject*)x)->ob_digit;
                                  ~~~~~~~~~~~~~~~~~~  ^
zmq/backend/cython/_version.c:3589:47: error: no member named 'ob_digit' in 'struct _longobject'
    const digit* digits = ((PyLongObject*)b)->ob_digit;
                          ~~~~~~~~~~~~~~~~~~  ^
5 warnings and 5 errors generated.
error: command '/usr/bin/cc' failed with exit code 1
*** Error code 1

Stop.
Comment 9 Rainer Hurling freebsd_committer freebsd_triage 2025-04-12 08:43:19 UTC
(In reply to Tatsuki Makino from comment #8)
It seems this error occurs with lang/cython (v. 2xx) installed? If this is true, could you please try again with lang/cython3?

There is some evidence [1] that we need cython3 for this problem.

[1] https://github.com/aio-libs/aiohttp/issues/7229#issuecomment-1450517855
Comment 10 Tatsuki Makino 2025-04-12 09:54:36 UTC
(In reply to Rainer Hurling from comment #9)

Thank you.

It is controlled by whether the variable USE_PYTHON is set to cython or cython3, and net/py-pyzmq uses cython.
It seems that by rewriting this in cython3, the build of net/py-pyzmq@py312 succeed.
Comment 11 Evgenii Khramtsov 2025-04-28 13:58:15 UTC
Add bug 286361 to "Depends on" please, I can't edit this bug. Regular Mesa likely needs this as well, but I didn't test.
Comment 12 Charlie Li freebsd_committer freebsd_triage 2025-04-28 14:12:30 UTC
(In reply to Evgenii Khramtsov from comment #11)
Same as regular mesa when able to be updated to the current release. As commented over in bug 286361, the correct additional BUILD_DEPENDS line is not setuptools but rather packaging.