Skip to content
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

[Bug] fail to build with python 3.13 #1616

Open
2 tasks done
hubutui opened this issue Dec 23, 2024 · 5 comments · May be fixed by #1617
Open
2 tasks done

[Bug] fail to build with python 3.13 #1616

hubutui opened this issue Dec 23, 2024 · 5 comments · May be fixed by #1617
Labels
bug Something isn't working

Comments

@hubutui
Copy link

hubutui commented Dec 23, 2024

Prerequisite

Environment

none

Reproduces the problem - code sample

none

Reproduces the problem - command or script

python -m build --wheel --no-isolation

Reproduces the problem - error message

==> Starting build()...
* Getting build dependencies for wheel...
<string>:5: DeprecationWarning: pkg_resources is deprecated as an API. See https://setuptools.pypa.io/en/latest/pkg_resources.html
Traceback (most recent call last):
  File "/usr/lib/python3.13/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
    main()
    ~~~~^^
  File "/usr/lib/python3.13/site-packages/pyproject_hooks/_in_process/_in_process.py", line 373, in main
    json_out["return_val"] = hook(**hook_input["kwargs"])
                             ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel
    return hook(config_settings)
  File "/usr/lib/python3.13/site-packages/setuptools/build_meta.py", line 332, in get_requires_for_build_wheel
    return self._get_build_requires(config_settings, requirements=[])
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/setuptools/build_meta.py", line 302, in _get_build_requires
    self.run_setup()
    ~~~~~~~~~~~~~~^^
  File "/usr/lib/python3.13/site-packages/setuptools/build_meta.py", line 516, in run_setup
    super().run_setup(setup_script=setup_script)
    ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.13/site-packages/setuptools/build_meta.py", line 318, in run_setup
    exec(code, locals())
    ~~~~^^^^^^^^^^^^^^^^
  File "<string>", line 131, in <module>
  File "<string>", line 32, in get_version
KeyError: '__version__'

ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel

Additional information

quick fix, update get_version in setup.py:

def get_version():
    version_dict = {}
    with open(version_file) as f:
        exec(compile(f.read(), version_file, 'exec'), version_dict)
    return version_dict['__version__']

see also https://docs.python.org/3/whatsnew/3.13.html#defined-mutation-semantics-for-locals

@hubutui
Copy link
Author

hubutui commented Dec 23, 2024

@hubutui
Copy link
Author

hubutui commented Dec 23, 2024

@hubutui
Copy link
Author

hubutui commented Dec 23, 2024

@hubutui
Copy link
Author

hubutui commented Dec 23, 2024

@hubutui
Copy link
Author

hubutui commented Dec 23, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant