I'm building openfaas function using: faas-cli build -f hello.yml

My YML file is:

version: 1.0
provider:
  name: openfaas
  gateway: http://127.0.0.1:8080
functions:
  hello:
    lang: python3
    handler: ./hello
    image: skum/hello:latest

My requirements.txt has:

boto3
dlib
face_recognition
opencv-python
ffmpeg

While building this YML file in getting the error:

Getting requirements to build wheel did not run successfully.
#22 24.77         │ exit code: 1
#22 24.77         ╰─> [33 lines of output]
#22 24.77             Traceback (most recent call last):
#22 24.77               File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
#22 24.77                 main()
#22 24.77               File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
#22 24.77                 json_out['return_val'] = hook(**hook_input['kwargs'])
#22 24.77                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#22 24.77               File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 112, in get_requires_for_build_wheel
#22 24.77                 backend = _build_backend()
#22 24.77                           ^^^^^^^^^^^^^^^^
#22 24.77               File "/usr/local/lib/python3.12/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 77, in _build_backend
#22 24.77                 obj = import_module(mod_path)
#22 24.77                       ^^^^^^^^^^^^^^^^^^^^^^^
#22 24.77               File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
#22 24.77                 return _bootstrap._gcd_import(name[level:], package, level)
#22 24.77                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
#22 24.77               File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
#22 24.77               File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
#22 24.77               File "<frozen importlib._bootstrap>", line 1304, in _find_and_load_unlocked
#22 24.77               File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
#22 24.77               File "<frozen importlib._bootstrap>", line 1381, in _gcd_import
#22 24.77               File "<frozen importlib._bootstrap>", line 1354, in _find_and_load
#22 24.77               File "<frozen importlib._bootstrap>", line 1325, in _find_and_load_unlocked
#22 24.77               File "<frozen importlib._bootstrap>", line 929, in _load_unlocked
#22 24.77               File "<frozen importlib._bootstrap_external>", line 994, in exec_module
#22 24.77               File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
#22 24.77               File "/tmp/pip-build-env-as732lb3/overlay/lib/python3.12/site-packages/setuptools/__init__.py", line 16, in <module>
#22 24.77                 import setuptools.version
#22 24.77               File "/tmp/pip-build-env-as732lb3/overlay/lib/python3.12/site-packages/setuptools/version.py", line 1, in <module>
#22 24.77                 import pkg_resources
#22 24.77               File "/tmp/pip-build-env-as732lb3/overlay/lib/python3.12/site-packages/pkg_resources/__init__.py", line 2172, in <module>
#22 24.77                 register_finder(pkgutil.ImpImporter, find_on_path)
#22 24.77                                 ^^^^^^^^^^^^^^^^^^^
#22 24.77             AttributeError: module 'pkgutil' has no attribute 'ImpImporter'. Did you mean: 'zipimporter'?
#22 24.77             [end of output]

I have handler.py and requirements.txt in the hello folder where my hello.yml is there, I tried building the faas function using the YML file but got this error. When I keep only boto3 in my requirements.txt file it builds successfully.

0

There are 0 best solutions below