Pendulum fails to build wheel whilst installing pgcli or indpendently

725 views Asked by At

I'm new to postgres and was doing a follow along. I did "pip install pgcli" but an error is thrown stating, can't build wheel for pendulum. Error Image

pip version: 23.3.1 python version: 3.12

command used: pip install pgcli

Error thrown:

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 "C:\Users\LENOVO\AppData\Local\Temp\pip-install-1q819wpp\pendulum_9df28829f560403da4102806a5dfc917\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 "C:\Users\LENOVO\AppData\Roaming\Python\Python312\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
          main()
        File "C:\Users\LENOVO\AppData\Roaming\Python\Python312\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\LENOVO\AppData\Roaming\Python\Python312\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 "C:\Users\LENOVO\AppData\Local\Temp\pip-build-env-59ovaevq\overlay\Lib\site-packages\poetry\core\masonry\api.py", line 58, in build_wheel
          return WheelBuilder.make_in(
                 ^^^^^^^^^^^^^^^^^^^^^
        File "C:\Users\LENOVO\AppData\Local\Temp\pip-build-env-59ovaevq\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 88, in make_in
          wb.build(target_dir=directory)
        File "C:\Users\LENOVO\AppData\Local\Temp\pip-build-env-59ovaevq\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 123, in build
          self._build(zip_file)
        File "C:\Users\LENOVO\AppData\Local\Temp\pip-build-env-59ovaevq\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 172, in _build
          self._run_build_script(self._package.build_script)
        File "C:\Users\LENOVO\AppData\Local\Temp\pip-build-env-59ovaevq\overlay\Lib\site-packages\poetry\core\masonry\builders\wheel.py", line 266, in _run_build_script
          subprocess.check_call([self.executable.as_posix(), build_script])
        File "C:\Program Files\Python312\Lib\subprocess.py", line 413, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['C:/Program Files/Python312/python.exe', '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
ERROR: Could not build wheels for pendulum, which is required to install pyproject.toml-based projects

I tried to use earlier versions of pendulum i.e. 20.0.5 and it installed successfully but when I tried pip install pgcli after, it did not work and same error was thrown.

1

There are 1 answers

0
Talha Tayyab On

ModuleNotFoundError: No module named 'distutils'

distutils is removed in Python 3.12

You can create a fresh virtual environment then try:

pip install setuptools

then

pip install pgcli

If this does not work then downgrade your python to 3.11 until we get a permanent fix.