ruamel.yaml

Facing issue while installing ruamel.yaml


When I am trying to install ruamel.yaml it is throwing the following error:

 ---> Running in 71801483b5a1
Collecting ruamel.yaml
  Downloading ruamel.yaml-0.17.21-py3-none-any.whl (109 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 109.5/109.5 kB 12.3 MB/s eta 0:00:00
Collecting ruamel.yaml.clib>=0.2.6
  Downloading ruamel.yaml.clib-0.2.6.tar.gz (180 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 180.7/180.7 kB 21.5 MB/s eta 0:00:00
  Preparing metadata (setup.py): started
  Preparing metadata (setup.py): finished with status 'error'
[91m  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [3 lines of output]
      sys.argv ['/tmp/pip-install-4z0awj5u/ruamel-yaml-clib_ebca93f6ff92409a86d7beb1a0f1b92c/setup.py', 'egg_info', '--egg-base', '/tmp/pip-pip-egg-info-odj056w3']
      test compiling /tmp/tmp_ruamel_ua_v5oye/test_ruamel_yaml.c -> test_ruamel_yaml compile error: /tmp/tmp_ruamel_ua_v5oye/test_ruamel_yaml.c
      Exception: 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.
[0m[91merror: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.

It was working previously. I am using docker and below are the commands being used in Dockerfile

RUN pip install ruamel.yaml
RUN pip install ruamel.yaml.jinja2

Solution

  • You get that error because the C compiler is not installed. One thing you can do is make sure the compiler is installed so that it can compile the ruamel.yaml.clib dependency.

    You are installing the ruamel.yaml wheel, and I cannot see why it is not taking the wheel for ruamel.yaml.clib. That might be caused by an architecture or Python version not being available for that architecture.

    If your code is not useing YAML(typ='safe') or anything else that actually uses the C loader, then you can also do:

    RUN pip install --no-deps ruamel.yaml