MycroftAI/mycroft-core

Unable to install PyYAML 5.4 on Debian Bullseye

goldyfruit opened this issue · 0 comments

Since Debian Bullseye, the PyYAML version 5.4 Python library cannot be installed on Debian Bullseye.

pip complains about yaml.h: No such file or directory which prevent the installation of PyYAML. I tried to install libyaml-dev which provide the yaml.h file without success.

I'm using the latest mycroft-core commit with pip 20.3.0 (I tried with the latest as well).

The workaround to get mycrof-core running is to install PyAML version 5.4.1.

Below is the Python trace when I try to install PyYAML 5.4.

$ pip install PyYAML==5.4
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting PyYAML==5.4
  Using cached PyYAML-5.4.tar.gz (174 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... done
    Preparing wheel metadata ... done
Building wheels for collected packages: PyYAML
  Building wheel for PyYAML (PEP 517) ... error
  ERROR: Command errored out with exit status 1:
   command: /home/pi/mycroft-core/.venv/bin/python3 /tmp/tmpdxjbwex4_in_process.py build_wheel /tmp/tmpf_p41el3
       cwd: /tmp/pip-install-_mig10of/pyyaml_7b5a5c6af741440cae086d7c90911050
  Complete output (83 lines):
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.linux-aarch64-3.9
  creating build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/tokens.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/serializer.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/scanner.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/resolver.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/representer.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/reader.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/parser.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/nodes.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/loader.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/events.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/error.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/emitter.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/dumper.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/cyaml.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/constructor.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/composer.py -> build/lib.linux-aarch64-3.9/yaml
  copying lib3/yaml/__init__.py -> build/lib.linux-aarch64-3.9/yaml
  creating build/lib.linux-aarch64-3.9/_yaml
  copying lib3/_yaml/__init__.py -> build/lib.linux-aarch64-3.9/_yaml
  running build_ext
  creating build/temp.linux-aarch64-3.9
  creating build/temp.linux-aarch64-3.9/yaml
  aarch64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -ffile-prefix-map=/build/python3.9-PN012d/python3.9-3.9.2=. -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -fPIC -I/home/pi/mycroft-core/.venv/include -I/usr/include/python3.9 -c yaml/_yaml.c -o build/temp.linux-aarch64-3.9/yaml/_yaml.o
  In file included from yaml/_yaml.c:696:
  yaml/_yaml.h:2:10: fatal error: yaml.h: No such file or directory
      2 | #include <yaml.h>
        |          ^~~~~~~~
  compilation terminated.
  Error compiling module, falling back to pure Python
  running install
  running install_lib
  Traceback (most recent call last):
    File "/tmp/tmpdxjbwex4_in_process.py", line 280, in <module>
      main()
    File "/tmp/tmpdxjbwex4_in_process.py", line 263, in main
      json_out['return_val'] = hook(**hook_input['kwargs'])
    File "/tmp/tmpdxjbwex4_in_process.py", line 204, in build_wheel
      return _build_backend().build_wheel(wheel_directory, config_settings,
    File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 216, in build_wheel
      return self._build_with_temp_dir(['bdist_wheel'], '.whl',
    File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 202, in _build_with_temp_dir
      self.run_setup()
    File "/usr/lib/python3/dist-packages/setuptools/build_meta.py", line 145, in run_setup
      exec(compile(code, __file__, 'exec'), locals())
    File "setup.py", line 271, in <module>
      setup(
    File "/usr/lib/python3/dist-packages/setuptools/__init__.py", line 153, in setup
      return distutils.core.setup(**attrs)
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 967, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 259, in run
      self.run_command('install')
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 986, in run_command
      cmd_obj.run()
    File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 61, in run
      return orig.install.run(self)
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/command/install.py", line 578, in run
      self.run_command(cmd_name)
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/dist.py", line 985, in run_command
      cmd_obj.ensure_finalized()
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 107, in ensure_finalized
      self.finalize_options()
    File "/usr/lib/python3/dist-packages/setuptools/command/install_lib.py", line 17, in finalize_options
      self.set_undefined_options('install',('install_layout','install_layout'))
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 290, in set_undefined_options
      setattr(self, dst_option, getattr(src_cmd_obj, src_option))
    File "/usr/lib/python3/dist-packages/setuptools/_distutils/cmd.py", line 103, in __getattr__
      raise AttributeError(attr)
  AttributeError: install_layout
  ----------------------------------------
  ERROR: Failed building wheel for PyYAML
Failed to build PyYAML
ERROR: Could not build wheels for PyYAML which use PEP 517 and cannot be installed directly