Search code examples
python-3.xdjangoamazon-web-servicesamazon-elastic-beanstalk

Build failed with aws ebcli on Python 3.11.4


When I try to install ebcli using Python 3.11.4 (inside a venv, as per the official instructions) I get an error and I just can't get around it.

But If I try to install ebcli using Python 3.8.10(again inside a venv) it works.

The error looks like this:

        File "/tmp/pip-build-env-yn_umd7x/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 336, in _add_defaults_ext
          self.filelist.extend(build_ext.get_source_files())
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "<string>", line 201, in get_source_files
        File "/tmp/pip-build-env-yn_umd7x/overlay/lib/python3.11/site-packages/setuptools/_distutils/cmd.py", line 107, in __getattr__
          raise AttributeError(attr)
      AttributeError: cython_sources
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

  • I already followed the troubleshooting recommendations, which consists on installing dependencies, and it didn't have any effect.
  • I already googled for this specific issue and I can't find a solution. I did find this issue containing AttributeError: cython_sources which might be related, but I don't know what action to take from there.

Solution

  • It is the pyyaml issue I had the similar issue when upgrading a legacy project from django 2 to 4:

    You can have a look at this post: Docker-compose no longer building image (AttributeError: cython_sources)

    You can also try this

    pip install "cython<3.0.0" && pip install --no-build-isolation pyyaml==6.0
    

    Just as mentioned here: https://github.com/yaml/pyyaml/issues/724#issuecomment-1638636728

    Or just as you did it:

    pip install --force-reinstall -v "PyYAML==6.0.1" --no-build-isolation
    

    Note: dowgrading to previous version should always be avoided as it may have serious security issue and that is why new version are released like in case of pyyaml.