sdispater/pendulum

support python 3.12 -> PEP 632, Remove the distutils package.

raphaelauv opened this issue · 13 comments

  • I am on the latest Pendulum version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • OS version and name: bullseye

  • Pendulum version: pendulum==2.1.2

Issue

× Building wheel for pendulum (pyproject.toml) did not run successfully.
│ exit code: 1
╰─> [27 lines of output]
   Traceback (most recent call last):
     File "/tmp/pip-install-wpyylaf5/pendulum_41fb4accb1eb497eb3f79d80659881b4/build.py", line 5, in <module>
       from distutils.command.build_ext import build_ext
   ModuleNotFoundError: No module named 'distutils'
   Traceback (most recent call last):
     File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
       main()
     File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
       json_out['return_val'] = hook(**hook_input['kwargs'])
                                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
       return _build_backend().build_wheel(wheel_directory, config_settings,
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     File "/tmp/pip-build-env-iee1xdz5/overlay/lib/python3.12/site-packages/poetry/core/masonry/api.py", line 56, in build_wheel
       return WheelBuilder.make_in(
              ^^^^^^^^^^^^^^^^^^^^^
     File "/tmp/pip-build-env-iee1xdz5/overlay/lib/python3.12/site-packages/poetry/core/masonry/builders/wheel.py", line 85, in make_in
       wb.build(target_dir=directory)
     File "/tmp/pip-build-env-iee1xdz5/overlay/lib/python3.12/site-packages/poetry/core/masonry/builders/wheel.py", line 120, in build
       self._build(zip_file)
     File "/tmp/pip-build-env-iee1xdz5/overlay/lib/python3.12/site-packages/poetry/core/masonry/builders/wheel.py", line 169, in _build
       self._run_build_script(self._package.build_script)
     File "/tmp/pip-build-env-iee1xdz5/overlay/lib/python3.12/site-packages/poetry/core/masonry/builders/wheel.py", line 229, in _run_build_script
       subprocess.check_call([self.executable.as_posix(), build_script])
     File "/usr/local/lib/python3.12/subprocess.py", line 413, in check_call
       raise CalledProcessError(retcode, cmd)
   subprocess.CalledProcessError: Command '['/usr/local/bin/python3', 'build.py']' returned non-zero exit status 1.
   [end of output]

sswam commented

Any workaround for this? It also doesn't work with latest python 3.10.10 for me in a venv on Debian bullseye. I tried to work around, eventually gave up and copied the installed package across from another system!

We are currently working towards releasing Pendulum 3.0, which will address this issue.

Any idea on when Pendulum 3.0 will be released?

Could you please add the 3.12 CI tests to main? Currently this is blocking a few packages in Fedora due to dependency chain

Could you please add the 3.12 CI tests to main? Currently this is blocking a few packages in Fedora due to dependency chain

@LecrisUT see #728

amotl commented

Dear Sébastien,

thanks a stack for your work on Pendulum. We are running into the same issue on Python 3.12 at https://github.com/panodata/aika.

We see it already has been fixed on the main branch, so may we humbly ask for a new release? There is no pressure though, Python 3.12 will only be released on 2023-10-02, so there are a few weeks left to support it properly.

With kind regards,
Andreas.

Is there a plan to release a fixed version?

The error in pendulum still occurs after Python 3.12 has been released.

Here's the error message for your reference.

pip install pendulum     
Collecting pendulum
  Using cached pendulum-2.1.2.tar.gz (81 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
  Preparing metadata (pyproject.toml) ... done
Collecting python-dateutil<3.0,>=2.6 (from pendulum)
  Using cached python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
Collecting pytzdata>=2020.1 (from pendulum)
  Using cached pytzdata-2020.1-py2.py3-none-any.whl (489 kB)
Collecting six>=1.5 (from python-dateutil<3.0,>=2.6->pendulum)
  Using cached six-1.16.0-py2.py3-none-any.whl (11 kB)
Building wheels for collected packages: pendulum
  Building wheel for pendulum (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for pendulum (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      Traceback (most recent call last):
        File "/private/var/folders/00/d8c5mq757qsd67rc5vdjzxfh0000gn/T/pip-install-_095_z76/pendulum_7c7e5588adb64891ac55f26a7321c809/build.py", line 5, in <module>
          from distutils.command.build_ext import build_ext
      ModuleNotFoundError: No module named 'distutils'
      Traceback (most recent call last):
        File "lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/00/d8c5mq757qsd67rc5vdjzxfh0000gn/T/pip-build-env-a1sh4src/overlay/lib/python3.12/site-packages/poetry/core/masonry/api.py", line 57, in build_wheel
          return WheelBuilder.make_in(
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/00/d8c5mq757qsd67rc5vdjzxfh0000gn/T/pip-build-env-a1sh4src/overlay/lib/python3.12/site-packages/poetry/core/masonry/builders/wheel.py", line 87, in make_in
          wb.build(target_dir=directory)
        File "/private/var/folders/00/d8c5mq757qsd67rc5vdjzxfh0000gn/T/pip-build-env-a1sh4src/overlay/lib/python3.12/site-packages/poetry/core/masonry/builders/wheel.py", line 122, in build
          self._build(zip_file)
        File "/private/var/folders/00/d8c5mq757qsd67rc5vdjzxfh0000gn/T/pip-build-env-a1sh4src/overlay/lib/python3.12/site-packages/poetry/core/masonry/builders/wheel.py", line 171, in _build
          self._run_build_script(self._package.build_script)
        File "/private/var/folders/00/d8c5mq757qsd67rc5vdjzxfh0000gn/T/pip-build-env-a1sh4src/overlay/lib/python3.12/site-packages/poetry/core/masonry/builders/wheel.py", line 231, in _run_build_script
          subprocess.check_call([self.executable.as_posix(), build_script])
        File ".pyenv/versions/3.12.0/lib/python3.12/subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['python3', 'build.py']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for pendulum
Failed to build pendulum

@blueskyjunkie have you tried the 3.0.0b1 release?

Thanks @edgarrmondragon . My transitive dependency had constrained the pendulum releases to exclude v3. I was able to widen the constraints and the project now installs correctly for Python 3.12 using pendulum 3.0.0b1.

I can confirm that pendulum 3.0.0b1 can be installed with Python 3.12.