commitizen-tools / commitizen

Create committing rules for projects :rocket: auto bump versions :arrow_up: and auto changelog generation :open_file_folder:
https://commitizen-tools.github.io/commitizen/
MIT License
2.45k stars 261 forks source link

Cannot install `commitizen` due to PyYAML #786

Closed stefanpantic-pdftools closed 1 year ago

stefanpantic-pdftools commented 1 year ago

Description

This issue is preventing me from installing Commitizen: https://github.com/yaml/pyyaml/issues/601

Can Commitizen lock the Cython version to something pre 3.0.0?

Steps to reproduce

pip install -U commitizen

Current behavior

ome: /github/home/.gnupg
Supported algorithms:
Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA2[24](https://github.com/pdf-tools/components-pipeline/actions/runs/5577726685/jobs/10190892960#step:4:25)
Compression: Uncompressed, ZIP, ZLIB, BZIP2
git version 2.40.1
Configuring Git username, email, and pull behavior...
Git name: github-actions[bot]
Git email: github-actions[bot]@users.noreply.github.com
pip install commitizen==3.5.2
WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag.
Collecting commitizen==3.5.2
  Downloading commitizen-3.5.2-py3-none-any.whl (57 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.1/57.1 kB 5.7 MB/s eta 0:00:00
Collecting pyyaml>=3.08
  Downloading PyYAML-6.0.tar.gz (124 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1[25](https://github.com/pdf-tools/components-pipeline/actions/runs/5577726685/jobs/10190892960#step:4:26).0/125.0 kB 16.7 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'error'
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [48 lines of output]
      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 "/usr/local/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.8/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.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line [28](https://github.com/pdf-tools/components-pipeline/actions/runs/5577726685/jobs/10190892960#step:4:29)8, in <module>
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 1234, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line [31](https://github.com/pdf-tools/components-pipeline/actions/runs/5577726685/jobs/10190892960#step:4:32)4, in run
          self.find_sources()
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line [32](https://github.com/pdf-tools/components-pipeline/actions/runs/5577726685/jobs/10190892960#step:4:33)2, in find_sources
          mm.run()
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 551, in run
          self.add_defaults()
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 589, in add_defaults
          sdist.add_defaults(self)
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/command/sdist.py", line 104, in add_defaults
          super().add_defaults()
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
          self._add_defaults_ext()
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line [33](https://github.com/pdf-tools/components-pipeline/actions/runs/5577726685/jobs/10190892960#step:4:34)6, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
        File "<string>", line 204, in get_source_files
        File "/tmp/pip-build-env-atpr8hah/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
          raise AttributeError(attr)
      AttributeError: cython_sources
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Notice:  A new release of pip is available: 23.0.1 -> 23.2
Notice:  To update, run: pip install --upgrade pip

Desired behavior

I can install Commitizen.

Screenshots

No response

Environment

alexandruvesa commented 1 year ago

Same for me with other libraries.

woile commented 1 year ago

PR's are welcome. I don't fully grasp the issue to make a proper PR, can someone elaborate? what happens if we lock cython? what happens if you install cython<3.x in your project?

phoenix1480 commented 1 year ago

@woile We are experiencing same issue and run the action from a GHES runner. This was working as of 3 days ago and we use Commitizen action to create all our releases. Was there a recent change to the upstream dependency @stefanpantic-pdftools ?

`gpg (GnuPG) 2.4.3 libgcrypt 1.10.2 Copyright (C) 2023 g10 Code GmbH License GNU GPL-3.0-or-later https://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Home: /github/home/.gnupg Supported algorithms: Pubkey: RSA, ELG, DSA, ECDH, ECDSA, EDDSA Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH, CAMELLIA128, CAMELLIA192, CAMELLIA256 Hash: SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224 Compression: Uncompressed, ZIP, ZLIB, BZIP2 git version 2.40.1 Configuring Git username, email, and pull behavior... Git name: github-actions[bot] Git email: github-actions[bot]@users.noreply.github.com pip install commitizen WARNING: The directory '/github/home/.cache/pip' or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions and owner of that directory. If executing pip with sudo, you should use sudo's -H flag. Collecting commitizen Downloading commitizen-3.5.3-py3-none-any.whl (57 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 57.1/57.1 kB 13.4 MB/s eta 0:00:00 Collecting importlib_metadata<7,>=4.13 Downloading importlib_metadata-6.8.0-py3-none-any.whl (22 kB) Collecting termcolor<3,>=1.1 Downloading termcolor-2.3.0-py3-none-any.whl (6.9 kB) Collecting decli<0.7.0,>=0.6.0 Downloading decli-0.6.1-py3-none-any.whl (7.8 kB) Collecting pyyaml>=3.08 Downloading PyYAML-6.0.tar.gz (124 kB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 125.0/125.0 kB 72.8 MB/s eta 0:00:00 Installing build dependencies: started Installing build dependencies: finished with status 'done' Getting requirements to build wheel: started Getting requirements to build wheel: finished with status 'error' error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [48 lines of output] 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 "/usr/local/lib/python3.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in main() File "/usr/local/lib/python3.8/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.8/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel return hook(config_settings) File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=['wheel']) File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires self.run_setup() File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/build_meta.py", line 338, in run_setup exec(code, locals()) File "", line 288, in File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/init.py", line 107, in setup return distutils.core.setup(attrs) File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 185, in setup return run_commands(dist) File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/_distutils/core.py", line 201, in run_commands dist.run_commands() File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/dist.py", line 1234, in run_command super().run_command(command) File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 314, in run self.find_sources() File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 322, in find_sources mm.run() File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 551, in run self.add_defaults() File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/command/egg_info.py", line 589, in add_defaults sdist.add_defaults(self) File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/command/sdist.py", line 104, in add_defaults super().add_defaults() File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults self._add_defaults_ext() File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext self.filelist.extend(build_ext.get_source_files()) File "", line 204, in get_source_files File "/tmp/pip-build-env-lp675kc4/overlay/lib/python3.8/site-packages/setuptools/_distutils/cmd.py", line 107, in getattr raise AttributeError(attr) AttributeError: cython_sources [end of output]

note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.

Notice: A new release of pip is available: 23.0.1 -> 23.2 Notice: To update, run: pip install --upgrade pip`

woile commented 1 year ago

The original issues has been fixed, is it the case for commitizen as well? Can the reporters check if it works now? Thanks

stefanpantic-pdftools commented 1 year ago

@woile fixed with https://github.com/yaml/pyyaml/pull/702#issuecomment-1639058497, closing now.

woile commented 1 year ago

Quick update, nothing changed on commitizen, before or after.

Pyyaml v5 and v6 are using a very lose version of cython, and cython v3 introduced a breaking change in pyyaml, thus breaking commitizen. pyyaml released v6.0.1 pinning cython to <3, but v5 is still broken. If you cannot upgrade pyyaml, a solution is to pin cython in your repo.

[tool.poetry.dependencies]
Cpython = "<3.0.0"

For commitizen case, if you still see this issue:

The github action should not be affected anymore.

Please be mindful with the maintainers, everyone is aware of this issues and they are trying to fix it asap. I think pyyaml will introduce a v5 fix soon as well.