Python SDK installation issue on alpine

I’m trying to install python couchbase in docker image with alpine for our internal library using poetry, but it fails with this kind of error.

$ docker build -t test -f Dockerfile .
# many logs here...
  ERROR: Failed building wheel for couchbase
Failed to build couchbase
ERROR: Could not build wheels for couchbase, which is required to install pyproject.toml-based projects

I tried to search any help and that’s what I found:

  1. Loading... with comment “Closing, alpine is tested in the build pipeline. We don’t currently release wheels for platforms other than windows so no work is needed there”

  2. couchbase client · Issue #350 · docker-library/python · GitHub an old issue with alpine and I didn’t get how it can help me to solve my issue.

I was able to reproduce the issue in a simple python image with pip.

Dockerfile:

FROM python:3.9.17-alpine3.18

RUN apk add --no-cache linux-headers libcrypto1.1 libssl1.1 libcouchbase libcouchbase-dev
RUN pip install couchbase

Docker image info

$ docker image ls python:3.9.17-alpine3.18
REPOSITORY   TAG                 IMAGE ID       CREATED      SIZE
python       3.9.17-alpine3.18   194ed5d4323f   7 days ago   53MB

the complete log with error is here:

$ docker build -t test -f Dockerfile .
Sending build context to Docker daemon  397.3kB
Step 1/3 : FROM python:3.9.17-alpine3.18
 ---> 194ed5d4323f
Step 2/3 : RUN apk add --no-cache linux-headers libcrypto1.1 libssl1.1 libcouchbase libcouchbase-dev
 ---> Using cache
 ---> 8241a8bbe152
Step 3/3 : RUN pip install couchbase
 ---> Running in 16a43cc869fe
Collecting couchbase
  Downloading couchbase-4.1.5.tar.gz (10.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.8/10.8 MB 22.1 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: couchbase
  Building wheel for couchbase (pyproject.toml): started
  Building wheel for couchbase (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error
  
  × Building wheel for couchbase (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [206 lines of output]
      Python SDK version: 4.1.5
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-39
      creating build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/n1ql.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/_version.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/scope.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/views.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/binary_collection.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/serializer.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/exceptions.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/mutation_state.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/options.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/constants.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/datastructures.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/_utils.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/metrics.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/diagnostics.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/subdocument.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/result.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/search.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/durability.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/bucket.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/otel_tracer.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/auth.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/collection.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/transcoder.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/cluster.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/tracing.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/analytics.py -> build/lib.linux-x86_64-cpython-39/couchbase
      creating build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/n1ql.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/scope.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/views.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/binary_collection.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/datastructures.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/search.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/__init__.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/bucket.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/collection.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/cluster.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/analytics.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      creating build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/n1ql.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/scope.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/views.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/binary_collection.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/search.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/__init__.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/bucket.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/collection.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/cluster.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/analytics.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      creating build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/encryption_result.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/decrypter.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/crypto_manager.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/keyring.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/key.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/encrypter.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      creating build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/transaction_keyspace.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/transaction_result.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/transaction_get_result.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/transaction_query_results.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/transactions.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      creating build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/n1ql.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/scope.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/views.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/options.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/search.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/supportability.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/bucket.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/collection.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/cluster.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/analytics.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/search_queries.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      creating build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/views.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/options.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/collections.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/buckets.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/queries.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/search.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/eventing.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/users.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/analytics.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      creating build/lib.linux-x86_64-cpython-39/couchbase/transactions/logic
      copying couchbase/transactions/logic/attempt_context_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions/logic
      copying couchbase/transactions/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions/logic
      copying couchbase/transactions/logic/transactions_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions/logic
      creating build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/users_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/view_index_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/buckets_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/analytics_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/eventing_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/collections_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/search_index_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/query_index_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      creating build/lib.linux-x86_64-cpython-39/acouchbase/transactions
      copying acouchbase/transactions/__init__.py -> build/lib.linux-x86_64-cpython-39/acouchbase/transactions
      copying acouchbase/transactions/transactions.py -> build/lib.linux-x86_64-cpython-39/acouchbase/transactions
      creating build/lib.linux-x86_64-cpython-39/acouchbase/logic
      copying acouchbase/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/acouchbase/logic
      copying acouchbase/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/acouchbase/logic
      creating build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/views.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/collections.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/buckets.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/queries.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/search.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/eventing.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/__init__.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/users.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/analytics.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      creating build/lib.linux-x86_64-cpython-39/acouchbase/management/logic
      copying acouchbase/management/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management/logic
      copying acouchbase/management/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management/logic
      creating build/lib.linux-x86_64-cpython-39/txcouchbase/logic
      copying txcouchbase/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/logic
      copying txcouchbase/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/logic
      creating build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/views.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/collections.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/buckets.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/queries.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/search.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/__init__.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/users.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/analytics.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      creating build/lib.linux-x86_64-cpython-39/txcouchbase/management/logic
      copying txcouchbase/management/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management/logic
      copying txcouchbase/management/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management/logic
      running build_ext
      CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
      CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
      CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
      -- Configuring incomplete, errors occurred!
      cmake config args: ['/tmp/pip-build-env-p4q1sahr/overlay/bin/cmake', '/tmp/pip-install-_v_gf0qe/couchbase_00cc9d48cdf04a8f8f65fb33de472c25', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-_v_gf0qe/couchbase_00cc9d48cdf04a8f8f65fb33de472c25/build/lib.linux-x86_64-cpython-39/couchbase', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=/tmp/pip-install-_v_gf0qe/couchbase_00cc9d48cdf04a8f8f65fb33de472c25/build/lib.linux-x86_64-cpython-39/couchbase', '-DOPENSSL_VERSION=1.1.1g']
      Traceback (most recent call last):
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.9/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/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 416, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 195, in <module>
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-p4q1sahr/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 142, in build_extension
        File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/tmp/pip-build-env-p4q1sahr/overlay/bin/cmake', '/tmp/pip-install-_v_gf0qe/couchbase_00cc9d48cdf04a8f8f65fb33de472c25', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-_v_gf0qe/couchbase_00cc9d48cdf04a8f8f65fb33de472c25/build/lib.linux-x86_64-cpython-39/couchbase', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=/tmp/pip-install-_v_gf0qe/couchbase_00cc9d48cdf04a8f8f65fb33de472c25/build/lib.linux-x86_64-cpython-39/couchbase', '-DOPENSSL_VERSION=1.1.1g']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for couchbase
Failed to build couchbase
ERROR: Could not build wheels for couchbase, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
The command '/bin/sh -c pip install couchbase' returned a non-zero code: 1

Will appreciate any kind of help.

Do you have ‘make’ installed? Or another build tool that can be used?

Here is a stackoverflow thread on that issue : makefile - CMAKE_MAKE_PROGRAM not found - Stack Overflow

Hi, mreiche, thank you for the quick response! Yep, I think that might be the point.

I updated my dockerfile with cmake, gcc and g++ installation (if some c code must to be compiled during couchbase client installation).

FROM python:3.9.17-alpine3.18

RUN apk add --no-cache cmake gcc g++ linux-headers libcrypto1.1 libssl1.1 libcouchbase libcouchbase-dev
RUN pip install couchbase

But, I’m still having the same error, here is new image build log.

$ docker build -t test -f Dockerfile .
Sending build context to Docker daemon  397.3kB
Step 1/3 : FROM python:3.9.17-alpine3.18
 ---> 194ed5d4323f
Step 2/3 : RUN apk add --no-cache cmake gcc g++ linux-headers libcrypto1.1 libssl1.1 libcouchbase libcouchbase-dev
 ---> Running in d3a9f7efc696
fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/main/x86_64/APKINDEX.tar.gz
fetch https://dl-cdn.alpinelinux.org/alpine/v3.18/community/x86_64/APKINDEX.tar.gz
(1/36) Installing libacl (2.3.1-r3)
(2/36) Installing lz4-libs (1.9.4-r4)
(3/36) Installing zstd-libs (1.5.5-r4)
(4/36) Installing libarchive (3.6.2-r2)
(5/36) Installing brotli-libs (1.0.9-r14)
(6/36) Installing libunistring (1.1-r1)
(7/36) Installing libidn2 (2.3.4-r1)
(8/36) Installing nghttp2-libs (1.53.0-r0)
(9/36) Installing libcurl (8.1.2-r0)
(10/36) Installing libformw (6.4_p20230506-r0)
(11/36) Installing libgcc (12.2.1_git20220924-r10)
(12/36) Installing rhash-libs (1.4.3-r2)
(13/36) Installing libstdc++ (12.2.1_git20220924-r10)
(14/36) Installing libuv (1.44.2-r2)
(15/36) Installing cmake (3.26.4-r0)
(16/36) Installing libstdc++-dev (12.2.1_git20220924-r10)
(17/36) Installing binutils (2.40-r7)
(18/36) Installing libgomp (12.2.1_git20220924-r10)
(19/36) Installing libatomic (12.2.1_git20220924-r10)
(20/36) Installing gmp (6.2.1-r3)
(21/36) Installing isl26 (0.26-r1)
(22/36) Installing mpfr4 (4.2.0-r3)
(23/36) Installing mpc1 (1.3.1-r1)
(24/36) Installing gcc (12.2.1_git20220924-r10)
(25/36) Installing musl-dev (1.2.4-r0)
(26/36) Installing libc-dev (0.7.2-r5)
(27/36) Installing g++ (12.2.1_git20220924-r10)
(28/36) Installing libcouchbase (3.3.7-r0)
(29/36) Installing pkgconf (1.9.5-r0)
(30/36) Installing openssl-dev (3.1.1-r1)
(31/36) Installing snappy (1.1.10-r1)
(32/36) Installing snappy-dev (1.1.10-r1)
(33/36) Installing libcouchbase-dev (3.3.7-r0)
(34/36) Installing libcrypto1.1 (1.1.1u-r0)
(35/36) Installing libssl1.1 (1.1.1u-r0)
(36/36) Installing linux-headers (6.3-r0)
Executing busybox-1.36.0-r9.trigger
OK: 317 MiB in 74 packages
Removing intermediate container d3a9f7efc696
 ---> 6d3023fea6cf
Step 3/3 : RUN pip install couchbase
 ---> Running in ede571c84576
Collecting couchbase
  Downloading couchbase-4.1.5.tar.gz (10.8 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 10.8/10.8 MB 24.6 MB/s eta 0:00:00
  Installing build dependencies: started
  Installing build dependencies: finished with status 'done'
  Getting requirements to build wheel: started
  Getting requirements to build wheel: finished with status 'done'
  Preparing metadata (pyproject.toml): started
  Preparing metadata (pyproject.toml): finished with status 'done'
Building wheels for collected packages: couchbase
  Building wheel for couchbase (pyproject.toml): started
  Building wheel for couchbase (pyproject.toml): finished with status 'error'
  error: subprocess-exited-with-error
  
  × Building wheel for couchbase (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [206 lines of output]
      Python SDK version: 4.1.5
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.linux-x86_64-cpython-39
      creating build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/n1ql.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/_version.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/scope.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/views.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/binary_collection.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/serializer.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/exceptions.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/mutation_state.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/options.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/constants.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/datastructures.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/_utils.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/metrics.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/diagnostics.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/subdocument.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/result.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/search.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/durability.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/bucket.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/otel_tracer.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/auth.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/collection.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/transcoder.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/cluster.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/tracing.py -> build/lib.linux-x86_64-cpython-39/couchbase
      copying couchbase/analytics.py -> build/lib.linux-x86_64-cpython-39/couchbase
      creating build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/n1ql.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/scope.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/views.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/binary_collection.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/datastructures.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/search.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/__init__.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/bucket.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/collection.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/cluster.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      copying acouchbase/analytics.py -> build/lib.linux-x86_64-cpython-39/acouchbase
      creating build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/n1ql.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/scope.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/views.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/binary_collection.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/search.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/__init__.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/bucket.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/collection.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/cluster.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      copying txcouchbase/analytics.py -> build/lib.linux-x86_64-cpython-39/txcouchbase
      creating build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/encryption_result.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/decrypter.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/crypto_manager.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/keyring.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/key.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/encrypter.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      copying couchbase/encryption/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/encryption
      creating build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/transaction_keyspace.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/transaction_result.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/transaction_get_result.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/transaction_query_results.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      copying couchbase/transactions/transactions.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions
      creating build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/n1ql.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/scope.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/views.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/options.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/search.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/supportability.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/bucket.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/collection.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/cluster.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/analytics.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      copying couchbase/logic/search_queries.py -> build/lib.linux-x86_64-cpython-39/couchbase/logic
      creating build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/views.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/options.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/collections.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/buckets.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/queries.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/search.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/eventing.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/users.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      copying couchbase/management/analytics.py -> build/lib.linux-x86_64-cpython-39/couchbase/management
      creating build/lib.linux-x86_64-cpython-39/couchbase/transactions/logic
      copying couchbase/transactions/logic/attempt_context_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions/logic
      copying couchbase/transactions/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions/logic
      copying couchbase/transactions/logic/transactions_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/transactions/logic
      creating build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/users_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/view_index_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/buckets_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/analytics_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/eventing_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/collections_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/search_index_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      copying couchbase/management/logic/query_index_logic.py -> build/lib.linux-x86_64-cpython-39/couchbase/management/logic
      creating build/lib.linux-x86_64-cpython-39/acouchbase/transactions
      copying acouchbase/transactions/__init__.py -> build/lib.linux-x86_64-cpython-39/acouchbase/transactions
      copying acouchbase/transactions/transactions.py -> build/lib.linux-x86_64-cpython-39/acouchbase/transactions
      creating build/lib.linux-x86_64-cpython-39/acouchbase/logic
      copying acouchbase/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/acouchbase/logic
      copying acouchbase/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/acouchbase/logic
      creating build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/views.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/collections.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/buckets.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/queries.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/search.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/eventing.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/__init__.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/users.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      copying acouchbase/management/analytics.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management
      creating build/lib.linux-x86_64-cpython-39/acouchbase/management/logic
      copying acouchbase/management/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management/logic
      copying acouchbase/management/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/acouchbase/management/logic
      creating build/lib.linux-x86_64-cpython-39/txcouchbase/logic
      copying txcouchbase/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/logic
      copying txcouchbase/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/logic
      creating build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/views.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/collections.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/buckets.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/queries.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/search.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/__init__.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/users.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      copying txcouchbase/management/analytics.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management
      creating build/lib.linux-x86_64-cpython-39/txcouchbase/management/logic
      copying txcouchbase/management/logic/wrappers.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management/logic
      copying txcouchbase/management/logic/__init__.py -> build/lib.linux-x86_64-cpython-39/txcouchbase/management/logic
      running build_ext
      CMake Error: CMake was unable to find a build program corresponding to "Unix Makefiles".  CMAKE_MAKE_PROGRAM is not set.  You probably need to select a different build tool.
      CMake Error: CMAKE_C_COMPILER not set, after EnableLanguage
      CMake Error: CMAKE_CXX_COMPILER not set, after EnableLanguage
      -- Configuring incomplete, errors occurred!
      cmake config args: ['/tmp/pip-build-env-0szwoxzc/overlay/bin/cmake', '/tmp/pip-install-s0sdk10h/couchbase_b1bf7b3b3f8d4390b5f0eb8fb160523c', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-s0sdk10h/couchbase_b1bf7b3b3f8d4390b5f0eb8fb160523c/build/lib.linux-x86_64-cpython-39/couchbase', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=/tmp/pip-install-s0sdk10h/couchbase_b1bf7b3b3f8d4390b5f0eb8fb160523c/build/lib.linux-x86_64-cpython-39/couchbase', '-DOPENSSL_VERSION=1.1.1g']
      Traceback (most recent call last):
        File "/usr/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/usr/local/lib/python3.9/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/local/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 251, in build_wheel
          return _build_backend().build_wheel(wheel_directory, config_settings,
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 416, in build_wheel
          return self._build_with_temp_dir(['bdist_wheel'], '.whl',
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 401, in _build_with_temp_dir
          self.run_setup()
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 195, in <module>
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/__init__.py", line 107, in setup
          return distutils.core.setup(**attrs)
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 185, in setup
          return run_commands(dist)
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/core.py", line 201, in run_commands
          dist.run_commands()
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands
          self.run_command(cmd)
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/wheel/bdist_wheel.py", line 343, in run
          self.run_command("build")
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build.py", line 131, in run
          self.run_command(cmd_name)
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/cmd.py", line 318, in run_command
          self.distribution.run_command(command)
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/dist.py", line 1244, in run_command
          super().run_command(command)
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/dist.py", line 988, in run_command
          cmd_obj.run()
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/command/build_ext.py", line 84, in run
          _build_ext.run(self)
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run
          self.build_extensions()
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions
          self._build_extensions_serial()
        File "/tmp/pip-build-env-0szwoxzc/overlay/lib/python3.9/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial
          self.build_extension(ext)
        File "<string>", line 142, in build_extension
        File "/usr/local/lib/python3.9/subprocess.py", line 373, in check_call
          raise CalledProcessError(retcode, cmd)
      subprocess.CalledProcessError: Command '['/tmp/pip-build-env-0szwoxzc/overlay/bin/cmake', '/tmp/pip-install-s0sdk10h/couchbase_b1bf7b3b3f8d4390b5f0eb8fb160523c', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=/tmp/pip-install-s0sdk10h/couchbase_b1bf7b3b3f8d4390b5f0eb8fb160523c/build/lib.linux-x86_64-cpython-39/couchbase', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=/tmp/pip-install-s0sdk10h/couchbase_b1bf7b3b3f8d4390b5f0eb8fb160523c/build/lib.linux-x86_64-cpython-39/couchbase', '-DOPENSSL_VERSION=1.1.1g']' returned non-zero exit status 1.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for couchbase
Failed to build couchbase
ERROR: Could not build wheels for couchbase, which is required to install pyproject.toml-based projects

[notice] A new release of pip is available: 23.0.1 -> 23.1.2
[notice] To update, run: pip install --upgrade pip
The command '/bin/sh -c pip install couchbase' returned a non-zero code: 1

Did you set the variables it is complaining about?
In the first message it is looking for something to process “Unix Makefiles” - which would be ‘make’, not ‘cmake’ (I think).

You were right. After set environment variables and make installation instead of cmake I can’t reproduce the error. Finally, after 10 minutes of work the docker image was built.

Final docker file:

FROM python:3.9.17-alpine3.18

RUN apk add --no-cache make gcc g++ linux-headers libcrypto1.1 libssl1.1 libcouchbase libcouchbase-dev
RUN CMAKE_MAKE_PROGRAM=make CMAKE_C_COMPILER=gcc CMAKE_CXX_COMPILER=g++ pip install couchbase

Now I need to find the way to forward this environment variables during poetry installation with project.toml. I don’t think that it’s a good idea to set these env variables for the whole poetry install process. Can you suggest something?

Ok, I just added installation of necessary dependencies before poetry install in my dockerfile and docker image build was succeeded, so no need to specify env variables.

My dockerfile looks like:

# internal base image with python 3.9 and poetry
FROM python3.9-with-poetry

# install requirements for python couchbase SDK installation
RUN apk add --no-cache make gcc g++ linux-headers libcrypto1.1 libssl1.1 libcouchbase libcouchbase-dev

COPY pyproject.toml poetry.lock ./
# install couchbase and other project dependencies
RUN poetry install

COPY src/ src/
COPY tests/ tests/

It still takes about 10-15 minutes to build the image, but I think it’s because poetry compiles C code for couchbase dependency and prepares a wheel for it. I’ll try to find out how to speed up the build process, but the main issue of the topic may be considered as resolved.

mreiche, thanks for your assistance!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.