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:
-
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”
-
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.