Getting error while building Docker image based on alpine

Getting this error while building docker image

× Getting requirements to build wheel did not run successfully.
 │ exit code: 1
 ╰─> [68 lines of output]
     /tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in `setup.cfg`
     !!
     
             ********************************************************************************
             The license_file parameter is deprecated, use license_files instead.
     
             By 2023-Oct-30, you need to update your project and remove deprecated calls
             or your builds will no longer be supported.
     
             See https://setuptools.pypa.io/en/latest/userguide/declarative_config.html for details.
             ********************************************************************************
     
     !!
       parsed = self.parsers.get(option_name, lambda x: x)(value)
     running egg_info
     writing lib3/PyYAML.egg-info/PKG-INFO
     writing dependency_links to lib3/PyYAML.egg-info/dependency_links.txt
     writing top-level names to lib3/PyYAML.egg-info/top_level.txt
     Traceback (most recent call last):
       File "/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
         main()
       File "/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
         json_out['return_val'] = hook(**hook_input['kwargs'])
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       File "/usr/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
         return hook(config_settings)
                ^^^^^^^^^^^^^^^^^^^^^
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 355, in get_requires_for_build_wheel
         return self._get_build_requires(config_settings, requirements=['wheel'])
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 325, in _get_build_requires
         self.run_setup()
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in run_setup
         exec(code, locals())
       File "<string>", line 271, in <module>
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/__init__.py", line 107, in setup
         return distutils.core.setup(**attrs)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 185, in setup
         return run_commands(dist)
                ^^^^^^^^^^^^^^^^^^
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
         dist.run_commands()
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
         self.run_command(cmd)
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/dist.py", line 1233, in run_command
         super().run_command(command)
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
         cmd_obj.run()
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 319, in run
         self.find_sources()
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 327, in find_sources
         mm.run()
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 549, in run
         self.add_defaults()
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/command/egg_info.py", line 587, in add_defaults
         sdist.add_defaults(self)
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/command/sdist.py", line 113, in add_defaults
         super().add_defaults()
       File "/tmp/pip-build-env-lu3huh4t/overlay/lib/python3.11/site-packages/setuptools/_distutils/command/sdist.py", line 251, in add_defaults
         self._add_defaults_ext()
       File "/tmp/pip-build-env-lu3huh4t/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-lu3huh4t/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.

Which Docker image? Is it an image you are creating yourself, or an image from Docket Hub?

What was the pip command that failed?

An error like the one you are seeing usually means something like:

  1. pip is trying to install a package from a source distribution
  2. pip tries to install the build requirements for the package, so it can make a wheel (binary) from the source distribution
  3. There is some dependency missing from the build environment, outside what pip is aware of or could install automatically, so step 2 fails.

This error will happen while trying to install a particular package. You should be able to see the name of the package pip was trying to build in the output before or after the error you posted. This will narrow down what might be missing from the build environment, as you can check that project’s documentation.

Because - I assume - pip is running inside the container while building the image, once you discover what dependency is missing it is a matter of adding that dependency to the image before the step that is failing.

image from docker hub image name> jenkins/inbound-agent based on alpine and on top of that I installd nodejs and yarn and top of that now i amy trying to package python3 dependency and aws-cli

Downloading aws_sam_cli-1.93.0-py3-none-any.whl.metadata (11 kB)
#7 680.8 Obtaining dependency information for aws-sam-cli>=1.80 from https://files.pythonhosted.org/packages/1d/5c/0d89a321f83aa95cb635ff81ff3abf16912538e03ff05b9e666201090a42/aws_sam_cli-1.92.0-py3-none-any.whl.metadata
#7 681.0 Downloading aws_sam_cli-1.92.0-py3-none-any.whl.metadata (12 kB)
#7 681.0 Collecting PyYAML==5.*,>=5.4.1 (from aws-sam-cli>=1.80)
#7 681.1 Downloading PyYAML-5.4.1.tar.gz (175 kB)
#7 681.2 ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 175.1/175.1 kB 3.6 MB/s eta 0:00:00
#7 681.4 Installing build dependencies: started
#7 687.3 Installing build dependencies: finished with status ‘done’
#7 687.3 Getting requirements to build wheel: started
#7 687.7 Getting requirements to build wheel: finished with status ‘error’
#7 687.7 error: subprocess-exited-with-error
#7 687.7
#7 687.7 × Getting requirements to build wheel did not run successfully.
#7 687.7 │ exit code: 1
#7 687.7 ╰─> [62 lines of output]
#7 687.7 /tmp/pip-build-env-7y0tiayg/overlay/lib/python3.9/site-packages/setuptools/config/setupcfg.py:293: _DeprecatedConfig: Deprecated config in setup.cfg

This is because of this issue: https://github.com/yaml/pyyaml/issues/724
Updating to PyYAML 6.0.1 should fix it

For Python 3.12

python - AttributeError: cython_sources - Stack Overflow