Docker-compose no longer building image (AttributeError: cython_sources)

Important security disclaimer: I would strongly discourage anyone downgrading PyYAML to 5.3.1, as versions before 5.4 all have a known CVE — CVE-2020-14343.


This issue was caused by an incompatibility of PyYAML<6.0.1 compiled under the version of Cython>=3.0, released on July 17, 2023.

This has now been fixed by a new release of PyYAML, tagged 6.0.1.

This release brings

No code changes; update PEP518 build metadata to require Cython < 3.0 until
packaging code is rewritten for Cython 3.0 compatibility.

As it can be read in this project announcements

So, as long as you don’t have a strict pinning of PyYAML to a specific version, which seems to be your case in your requirements file, then, everything would be working properly again.


If your library is constrained to PyYAML<6.0, a fix could be to install the said library with the flag --no-build-isolation:

python -m pip install --no-build-isolation \
  <problematic-library-depending-on-old-verion-of-PyYAML>

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)