How to install ruamel.yaml w/o native extension

875 views Asked by At

I'd like to install ruamel.yaml on an environment which does not have a compiler, and I do not care about the performances.

What is the proper way to install ruamel.yaml w/o pip trying to build the extension and failing to execute the C compiler which is not installed?

I ran

pip3 install ruamel.yaml

which failed with

building '_ruamel_yaml' extension
creating build/temp.linux-x86_64-3.6
creating build/temp.linux-x86_64-3.6/ext
gcc -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -Os -fomit-frame-pointer -g -DTHREAD_STACK_SIZE=0x100000 -fPIC -I/usr/include/python3.6m -c ext/_ruamel_yaml.c -o build/temp.linux-x86_64-3.6/ext/_ruamel_yaml.o
unable to execute 'gcc': No such file or directory
error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/usr/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-myos8iv1/ruamel.yaml/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-vuvr4aoi/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-myos8iv1/ruamel.yaml/
1

There are 1 answers

0
Anthon On BEST ANSWER

Testing if compilation worked and skipping compiling the C extensions if it didn't, was removed from ruamel.yaml when it was no longer dependent on libyaml being available.

That of course doens't mean that the C compiler is available, so this should be considered a regression. In ruamel.yaml>=0.15.41 this should be fixed.