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

poetry install failing on Python 3.12 #581

Open
DMRobertson opened this issue Nov 20, 2023 · 2 comments
Open

poetry install failing on Python 3.12 #581

DMRobertson opened this issue Nov 20, 2023 · 2 comments

Comments

@DMRobertson
Copy link
Contributor

Testing on my machine I had to install python3.12-devel so I could compile something:

  • Installing cffi (1.15.0): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke build_wheel
  
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-x86_64-cpython-312
  creating build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/verifier.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/vengine_gen.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/vengine_cpy.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/setuptools_ext.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/recompiler.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/pkgconfig.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/model.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/lock.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/ffiplatform.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/error.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/cparser.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/commontypes.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/cffi_opcode.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/backend_ctypes.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/api.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/__init__.py -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/_cffi_include.h -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/parse_c_type.h -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/_embedding.h -> build/lib.linux-x86_64-cpython-312/cffi
  copying cffi/_cffi_errors.h -> build/lib.linux-x86_64-cpython-312/cffi
  running build_ext
  building '_cffi_backend' extension
  creating build/temp.linux-x86_64-cpython-312
  creating build/temp.linux-x86_64-cpython-312/c
  gcc -fno-strict-overflow -Wsign-compare -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -O2 -fexceptions -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -fstack-protector-strong -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fPIC -DUSE__THREAD -DHAVE_SYNC_SYNCHRONIZE -I/tmp/tmp9n0861nj/.venv/include -I/usr/include/python3.12 -c c/_cffi_backend.c -o build/temp.linux-x86_64-cpython-312/c/_cffi_backend.o
  c/_cffi_backend.c:2:10: fatal error: Python.h: No such file or directory
      2 | #include <Python.h>
        |          ^~~~~~~~~~
  compilation terminated.
  error: command '/usr/bin/gcc' failed with exit code 1
  

  at ~/.local/pipx/venvs/poetry/lib64/python3.11/site-packages/poetry/installation/chef.py:147 in _prepare
      143│ 
      144│                 error = ChefBuildError("\n\n".join(message_parts))
      145│ 
      146│             if error is not None:
    → 147│                 raise error from None
      148│ 
      149│             return path
      150│ 
      151│     def _prepare_sdist(self, archive: Path, destination: Path | None = None) -> Path:

Note: This error originates from the build backend, and is likely not a problem with poetry but with cffi (1.15.0) not supporting PEP 517 builds. You can verify this by running 'pip wheel --use-pep517 "cffi (==1.15.0)"'.

Then I got a failure to build pyyaml, which I wasn't sure how to respond:

  • Installing pyyaml (6.0): Failed

  ChefBuildError

  Backend subprocess exited when trying to invoke get_requires_for_build_wheel
  
  running egg_info
  writing lib/PyYAML.egg-info/PKG-INFO
  writing dependency_links to lib/PyYAML.egg-info/dependency_links.txt
  writing top-level names to lib/PyYAML.egg-info/top_level.txt
  Traceback (most recent call last):
    File "/home/dmr/.local/pipx/venvs/poetry/lib64/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
      main()
    File "/home/dmr/.local/pipx/venvs/poetry/lib64/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 335, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/home/dmr/.local/pipx/venvs/poetry/lib64/python3.11/site-packages/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
      return hook(config_settings)
             ^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 325, in get_requires_for_build_wheel
      return self._get_build_requires(config_settings, requirements=['wheel'])
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 295, in _get_build_requires
      self.run_setup()
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/build_meta.py", line 311, in run_setup
      exec(code, locals())
    File "<string>", line 288, in <module>
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/__init__.py", line 103, in setup
      return distutils.core.setup(**attrs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 185, in setup
      return run_commands(dist)
             ^^^^^^^^^^^^^^^^^^
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
      dist.run_commands()
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
      self.run_command(cmd)
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/dist.py", line 963, in run_command
      super().run_command(command)
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
      cmd_obj.run()
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 321, in run
      self.find_sources()
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 329, in find_sources
      mm.run()
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 551, in run
      self.add_defaults()
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/command/egg_info.py", line 589, in add_defaults
      sdist.add_defaults(self)
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/command/sdist.py", line 112, in add_defaults
      super().add_defaults()
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
      self._add_defaults_ext()
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
      self.filelist.extend(build_ext.get_source_files())
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    File "<string>", line 204, in get_source_files
    File "/tmp/tmp3u9h60si/.venv/lib/python3.12/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
      raise AttributeError(attr)
  AttributeError: cython_sources

Likely can workaround this by bumping locked deps to pull in newer wheels.

@DMRobertson
Copy link
Contributor Author

And matrix_is_tester fails on 3.12:

Error: 
Traceback (most recent call last):
  File "/home/runner/.cache/pypoetry/virtualenvs/matrix-sydent-r98p0WH--py3.12/lib/python3.12/site-packages/twisted/trial/runner.py", line 596, in loadPackage
    module = modinfo.load()
  File "/home/runner/.cache/pypoetry/virtualenvs/matrix-sydent-r98p0WH--py3.12/lib/python3.12/site-packages/twisted/python/modules.py", line 389, in load
    return self.pathEntry.pythonPath.moduleLoader(self.name)
  File "/home/runner/.cache/pypoetry/virtualenvs/matrix-sydent-r98p0WH--py3.12/lib/python3.12/site-packages/twisted/python/reflect.py", line 297, in namedAny
    topLevelPackage = _importAndCheckStack(trialname)
  File "/home/runner/.cache/pypoetry/virtualenvs/matrix-sydent-r98p0WH--py3.12/lib/python3.12/site-packages/twisted/python/reflect.py", line 244, in _importAndCheckStack
    raise excValue.with_traceback(excTraceback)
  File "/home/runner/.cache/pypoetry/virtualenvs/matrix-sydent-r98p0WH--py3.12/lib/python3.12/site-packages/matrix_is_tester/test_v2.py", line 21, in <module>
    from matrix_is_tester.base_api_test import BaseApiTest
  File "/home/runner/.cache/pypoetry/virtualenvs/matrix-sydent-r98p0WH--py3.12/lib/python3.12/site-packages/matrix_is_tester/base_api_test.py", line 28, in <module>
    from matrix_is_tester.mailsink import get_shared_mailsink
  File "/home/runner/.cache/pypoetry/virtualenvs/matrix-sydent-r98p0WH--py3.12/lib/python3.12/site-packages/matrix_is_tester/mailsink.py", line 17, in <module>
    import asyncore
builtins.ModuleNotFoundError: No module named 'asyncore'

@DMRobertson
Copy link
Contributor Author

I thought I could quickly fix this in #582, but matrix_is_tester uses asyncore which I think was removed in 3.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.

1 participant