Menu

#555 Installation fails when no gcc is available

closed
nobody
None
major
bug
2026-01-05
2026-01-02
No

The lateast version (0.19.0) changed to ruamel.yaml.clibz, I understand you can do this to installing it correctly in a non-gcc environment;

pip install --no-deps ruamel.yaml ruamel.yaml.clib

Which works fine if that is the starting point (or a direct dependency of a package). But often, it isn't.

Some projects, like ansible-lint have your package as a sub-sub dependency, making it impossible for circumvent this.
Example of direct dependency is pre-commit-hooks, there you can circumvent it by installing it first.

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v6.0.0
    hooks:
      - id: check-yaml
        additional_dependencies: [--no-deps, ruamel.yaml, ruamel.yaml.clib]

But for sub-sub deps, there's no way to prevent it it seems. This is regardless of pip or python version. See the following output. The no-deps works fine;

$ pip install --no-deps ruamel.yaml ruamel.yaml.clib
Looking in indexes: https://pypi.org/simple, <PRIVATE INDEXES>
Collecting ruamel.yaml
  Downloading ruamel_yaml-0.19.0-py3-none-any.whl.metadata (15 kB)
Collecting ruamel.yaml.clib
  Downloading ruamel_yaml_clib-0.2.15-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (3.5 kB)
Downloading ruamel_yaml-0.19.0-py3-none-any.whl (117 kB)
Downloading ruamel_yaml_clib-0.2.15-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (777 kB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 777.6/777.6 kB 3.1 MB/s  0:00:00
Installing collected packages: ruamel.yaml.clib, ruamel.yaml
Successfully installed ruamel.yaml-0.19.0 ruamel.yaml.clib-0.2.15

Then I want to install ansible-lint, but cannot pass the no-deps since we need those of this package;

$ pip install ansible-lint
Looking in indexes: https://pypi.org/simple, <PRIVATE INDECES>
Collecting ansible-lint
  Downloading ansible_lint-25.12.2-py3-none-any.whl.metadata (6.4 kB)
Collecting ansible-compat>=25.8.2 (from ansible-lint)
  Downloading ansible_compat-25.12.0-py3-none-any.whl.metadata (3.4 kB)
Requirement already satisfied: ansible-core>=2.16.14 in /opt/venv/lib/python3.11/site-packages (from ansible-lint) (2.16.15)
Collecting black>=24.3.0 (from ansible-lint)
  Downloading black-25.12.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl.metadata (86 kB)
Requirement already satisfied: cffi>=1.15.1 in /opt/venv/lib/python3.11/site-packages (from ansible-lint) (2.0.0)
Requirement already satisfied: cryptography>=38 in /opt/venv/lib/python3.11/site-packages (from ansible-lint) (46.0.3)
Collecting distro>=1.9.0 (from ansible-lint)
  Downloading distro-1.9.0-py3-none-any.whl.metadata (6.8 kB)
Requirement already satisfied: filelock>=3.8.2 in /opt/venv/lib/python3.11/site-packages (from ansible-lint) (3.20.1)
Collecting jsonschema>=4.10.0 (from ansible-lint)
  Downloading jsonschema-4.25.1-py3-none-any.whl.metadata (7.6 kB)
Requirement already satisfied: packaging>=22.0 in /opt/venv/lib/python3.11/site-packages (from ansible-lint) (25.0)
Collecting pathspec>=0.10.3 (from ansible-lint)
  Downloading pathspec-0.12.1-py3-none-any.whl.metadata (21 kB)
Requirement already satisfied: pyyaml>=6.0.1 in /opt/venv/lib/python3.11/site-packages (from ansible-lint) (6.0.3)
Collecting referencing>=0.36.2 (from ansible-lint)
  Downloading referencing-0.37.0-py3-none-any.whl.metadata (2.8 kB)
Requirement already satisfied: ruamel-yaml>=0.18.11 in /opt/venv/lib/python3.11/site-packages (from ansible-lint) (0.19.0)
Requirement already satisfied: ruamel-yaml-clib>=0.2.12 in /opt/venv/lib/python3.11/site-packages (from ansible-lint) (0.2.15)
Collecting subprocess-tee>=0.4.1 (from ansible-lint)
  Downloading subprocess_tee-0.4.2-py3-none-any.whl.metadata (3.3 kB)
Collecting wcmatch>=8.1.2 (from ansible-lint)
  Downloading wcmatch-10.1-py3-none-any.whl.metadata (5.1 kB)
Collecting yamllint>=1.34.0 (from ansible-lint)
  Downloading yamllint-1.37.1-py3-none-any.whl.metadata (4.3 kB)
Requirement already satisfied: jinja2>=3.0.0 in /opt/venv/lib/python3.11/site-packages (from ansible-core>=2.16.14->ansible-lint) (3.1.6)
Requirement already satisfied: resolvelib<1.1.0,>=0.5.3 in /opt/venv/lib/python3.11/site-packages (from ansible-core>=2.16.14->ansible-lint) (1.0.1)
Collecting click>=8.0.0 (from black>=24.3.0->ansible-lint)
  Downloading click-8.3.1-py3-none-any.whl.metadata (2.6 kB)
Collecting mypy-extensions>=0.4.3 (from black>=24.3.0->ansible-lint)
  Downloading mypy_extensions-1.1.0-py3-none-any.whl.metadata (1.1 kB)
Requirement already satisfied: platformdirs>=2 in /opt/venv/lib/python3.11/site-packages (from black>=24.3.0->ansible-lint) (4.5.1)
Collecting pytokens>=0.3.0 (from black>=24.3.0->ansible-lint)
  Downloading pytokens-0.3.0-py3-none-any.whl.metadata (2.0 kB)
Requirement already satisfied: pycparser in /opt/venv/lib/python3.11/site-packages (from cffi>=1.15.1->ansible-lint) (2.23)
Requirement already satisfied: MarkupSafe>=2.0 in /opt/venv/lib/python3.11/site-packages (from jinja2>=3.0.0->ansible-core>=2.16.14->ansible-lint) (3.0.3)
Collecting attrs>=22.2.0 (from jsonschema>=4.10.0->ansible-lint)
  Downloading attrs-25.4.0-py3-none-any.whl.metadata (10 kB)
Collecting jsonschema-specifications>=2023.03.6 (from jsonschema>=4.10.0->ansible-lint)
  Downloading jsonschema_specifications-2025.9.1-py3-none-any.whl.metadata (2.9 kB)
Collecting rpds-py>=0.7.1 (from jsonschema>=4.10.0->ansible-lint)
  Downloading rpds_py-0.30.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.metadata (4.1 kB)
Collecting typing-extensions>=4.4.0 (from referencing>=0.36.2->ansible-lint)
  Downloading typing_extensions-4.15.0-py3-none-any.whl.metadata (3.3 kB)
Collecting ruamel.yaml.clibz>=0.3.3 (from ruamel-yaml>=0.18.11->ansible-lint)
  Downloading ruamel_yaml_clibz-0.3.5.tar.gz (231 kB)
  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 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Collecting bracex>=2.1.1 (from wcmatch>=8.1.2->ansible-lint)
  Downloading bracex-2.6-py3-none-any.whl.metadata (3.6 kB)
Downloading ansible_lint-25.12.2-py3-none-any.whl (323 kB)
Downloading ansible_compat-25.12.0-py3-none-any.whl (27 kB)
Downloading black-25.12.0-cp311-cp311-manylinux2014_x86_64.manylinux_2_17_x86_64.manylinux_2_28_x86_64.whl (1.8 MB)
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 1.8/1.8 MB 54.0 MB/s  0:00:00
Downloading click-8.3.1-py3-none-any.whl (108 kB)
Downloading distro-1.9.0-py3-none-any.whl (20 kB)
Downloading jsonschema-4.25.1-py3-none-any.whl (90 kB)
Downloading attrs-25.4.0-py3-none-any.whl (67 kB)
Downloading jsonschema_specifications-2025.9.1-py3-none-any.whl (18 kB)
Downloading mypy_extensions-1.1.0-py3-none-any.whl (5.0 kB)
Downloading pathspec-0.12.1-py3-none-any.whl (31 kB)
Downloading pytokens-0.3.0-py3-none-any.whl (12 kB)
Downloading referencing-0.37.0-py3-none-any.whl (26 kB)
Downloading rpds_py-0.30.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (390 kB)
Downloading subprocess_tee-0.4.2-py3-none-any.whl (5.2 kB)
Downloading typing_extensions-4.15.0-py3-none-any.whl (44 kB)
Downloading wcmatch-10.1-py3-none-any.whl (39 kB)
Downloading bracex-2.6-py3-none-any.whl (11 kB)
Downloading yamllint-1.37.1-py3-none-any.whl (68 kB)
Building wheels for collected packages: ruamel.yaml.clibz
  Building wheel for ruamel.yaml.clibz (pyproject.toml): started
  Building wheel for ruamel.yaml.clibz (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error

  × Building wheel for ruamel.yaml.clibz (pyproject.toml) did not run successfully.
   exit code: 1
  ╰─> [9 lines of output]
      /tmp/pip-build-env-5gxfqjnp/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py:289: UserWarning: Unknown distribution option: 'build_zig'
        warnings.warn(msg)
      running bdist_wheel
      running build
      running build_ext
      building '_ruamel_yaml_clibz' extension
      creating build/temp.linux-x86_64-cpython-311
      gcc -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -fPIC -I/opt/venv/include -I/usr/local/include/python3.11 -c _ruamel_yaml_clibz.c -o build/temp.linux-x86_64-cpython-311/_ruamel_yaml_clibz.o
      error: command 'gcc' failed: No such file or directory
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for ruamel.yaml.clibz
Failed to build ruamel.yaml.clibz
error: failed-wheel-build-for-install
× Failed to build installable wheels for some pyproject.toml based projects
╰─> ruamel.yaml.clibz

Trying to pass it one go gives the same result;

$ pip install ruamel.yaml ruamel.yaml.clib ansible-lint

Requirement already satisfied: ruamel.yaml in /opt/venv/lib/python3.11/site-packages (0.19.0)
Requirement already satisfied: ruamel.yaml.clib in /opt/venv/lib/python3.11/site-packages (0.2.15)
Collecting ansible-lint
  Downloading ansible_lint-25.12.2-py3-none-any.whl.metadata (6.4 kB)
Collecting ruamel.yaml.clibz>=0.3.3 (from ruamel.yaml)
  Downloading ruamel_yaml_clibz-0.3.5.tar.gz (231 kB)
  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 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'

For now, I pinned our project on the previous version (0.18.17).

Discussion

  • Anthon van der Neut

    gcc is not needed to build install ruamel.yaml==0.19.0 what is needed is an up-to-date version of setuptools and wheels, as specified in the README. If that is not done Python installs warns about build_zig, does not follow the build dependencies, and then happely just tries to invoke gcc.

    The pass in one go would only still try to install ruamel.yaml.clibz (which is the dependency that throws the error when you have the wrong setuptools). You would have to specify --no-deps ruamel.yaml ruamel.yaml.clib

    I now have added that dependency on setuptools in ruamel.yaml.clibz, in a different way than I had tried before (and that did not work). Not ideal for me because it makes creating the distribution more difficult, but I hope it solves your problem.
    Can you try again and see if ruamel.yaml.clibz==0.3.7 fixed this (it is on PyPI).

     
  • Anthon van der Neut

    • status: open --> closed
     
  • Anthon van der Neut

    I am not sure how ansible uses ruamel.yaml, but I changed it in 0.19.1, that the dependency on ruamel.yaml.clibz is optional and it is only using built-in pure Python.
    several users/packages did not follow the instructions to have an up-to-date setuptools installed, which is probably the cause for your issue. I try to enforce that now, so this might work for ansible/your environment.
    I was not aware of ansible using ruamel.yaml, and certainly not that it didn't pin a version they tested as suggested in the README. So maybe it is an idea to notify anisble-lint (or the sub-sub package) that they should do this.,
    In any case you should be able to set your pin of ruamel.yaml on 0.19.1

     

Log in to post a comment.