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

Cannot install on Python 3.12 #24

Closed
tpdn opened this issue Oct 9, 2023 · 1 comment
Closed

Cannot install on Python 3.12 #24

tpdn opened this issue Oct 9, 2023 · 1 comment

Comments

@tpdn
Copy link

tpdn commented Oct 9, 2023

Cythonについてはあまり詳しくないのですが、Cythonのコードがc++に変換される際にPyUnicode_FromUnicodeを使用しているように見えます。
これは削除が予告されていた非推奨APIであり、予告通りに3.12.0にて削除されたためエラーが発生しています。


mojimoji.pyx is converted to C++ code using PyUnicode_FromUnicode.
However, PyUnicode_FromUnicode is a legacy interface and has been removed in Python 3.12.

https://docs.python.org/3.12/c-api/unicode.html
https://docs.python.org/3.11/c-api/unicode.html
https://peps.python.org/pep-0623/

Therefore, the following error occurs on Python 3.12.

[20:21:32] tpdn@GrandMacdoBookProXP /Users/tpdn/gitlab/tpdn/hoge [2] 
> pdm add mojimoji
Adding packages to default dependencies: mojimoji
🔒 Lock successful
Changes are written to pyproject.toml.
Synchronizing working set with resolved packages: 1 to add, 0 to update, 0 to remove

  ✖ Install mojimoji 0.0.12 failed
Retry failed jobs
  ✖ Install mojimoji 0.0.12 failed

ERRORS:
add mojimoji failed:
Traceback (most recent call last):
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/installers/synchronizers.py", line
283, in install_candidate
    self.manager.install(can)
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/installers/manager.py", line 33, 
in install
    installer(str(prepared.build()), self.environment, prepared.direct_url())
                  ^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/models/candidates.py", line 395, 
in build
    self.wheel = Path(builder.build(build_dir, metadata_directory=self._metadata_dir))
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/builders/wheel.py", line 28, in 
build
    filename = self._hook.build_wheel(out_dir, config_settings, metadata_directory)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pyproject_hooks/_impl.py", line 209, 
in build_wheel
    return self._call_hook('build_wheel', {
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pyproject_hooks/_impl.py", line 311, 
in _call_hook
    self._subprocess_runner(
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/builders/base.py", line 260, in 
subprocess_runner
    return log_subprocessor(cmd, cwd, extra_environ=env)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/tpdn/.pyenv/versions/3.12.0/lib/python3.12/site-packages/pdm/builders/base.py", line 107, in 
log_subprocessor
    raise build_error(e) from None
pdm.exceptions.BuildError: Build backend raised error: Showing the last 10 lines of the build output:
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
                                             ^
mojimoji.cpp:5212:16: error: use of undeclared identifier 'PyUnicode_FromUnicode'
  __pyx_t_10 = __Pyx_PyUnicode_FromUnicode(__pyx_v_buf); if (unlikely(!__pyx_t_10)) __PYX_ERR(0, 186, 
__pyx_L1_error)
               ^
mojimoji.cpp:1323:46: note: expanded from macro '__Pyx_PyUnicode_FromUnicode'
#define __Pyx_PyUnicode_FromUnicode(u)       PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u))
                                             ^
2 errors generated.
error: command '/usr/bin/clang' failed with exit code 1

See /var/folders/1b/fvjyq4dn47d19yyhd39w4qs80000gn/T/pdm-install-n40llblw.log for detailed debug log.
[InstallationError]: Some package operations are not complete yet
Add '-v' to see the detailed traceback
@ikuyamada
Copy link
Member

イシューを報告いただきありがとうございます。
0.0.13にてPython3.12でも正しくインストールできるようになっていると思います。

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

Successfully merging a pull request may close this issue.

2 participants