Scan your whole stack
From OX Research Newsroom
Are you using couchbase?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v4.7.0
couchbase was last scanned on 20 Nov 2026 at version 4.7.0. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 4.7.0 LATEST | 20 Nov 2026 | No rules fired |
| 4.7.0rc2 | 20 Nov 2026 | No rules fired |
| 4.7.0rc1 | 19 Nov 2026 | No rules fired |
| 4.6.4 | 28 Oct 2026 | Not shown |
| 4.6.4rc1 | 27 Oct 2026 | Not shown |
Findings for v4.7.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 4.7.0; other versions have their own rules, not their own score.
1 CRITICAL 0 HIGH 0 MEDIUM 0 LOW
The publisher’s own README, as collected from the registry.
Python client for Couchbase
NOTE: This is the documentation for the 4.x version of the client. This is mostly compatible with the older 3.x version. Please refer to the release32 branch for the older 3.x version.
First-time setup:
$ sudo apt install git-all python3-dev python3-pip python3-setuptools cmake build-essential libssl-dev
NOTE: We have provided Dockerfiles to demonstrate steps to achieve a working setup for various linux platforms. See the dockerfiles folder in the Python SDK examples folder for details.
See Debian and Ubuntu install section to install SDK.
First-time setup:
$ sudo yum install git-all gcc gcc-c++ python3-devel python3-pip python3-setuptools cmake openssl-devel
:exclamation:IMPORTANT:exclamation:Some of the defaults for older operating systems like Centos/RHEL 7 and 8 have defaults to do not meet the 4.x Python SDK minimum requirements. Be sure to update to the minimum requirements prior to installing the SDK. Most notably be sure to check the following:
- The default Python version might be less than 3.7. If so, the Python version will need to be udpated.
- The default OpenSSL version might be less than 1.1.1. If so, the OpenSSL version will need to be updated.
- The gcc version must provide C++17 support. If the installed gcc version does not support C++17, gcc will need to be updated.
- The installed CMake version might be less than 3.17. If so, the CMake version will need to be updated. Check out the steps here to update CMake.
NOTE: We have provided Dockerfiles to demonstrate steps to achieve a working setup for various linux platforms. See the dockerfiles folder in the Python SDK examples folder for details.
See RHEL and Centos install section to install SDK.
It is not recommended to use the vendor-supplied Python that ships with OS X. Best practice is to use a Python virtual environment such as pyenv or venv (after another version of Python that is not vendor-supplied has been installed) to manage multiple versions of Python.
:exclamation:IMPORTANT:exclamation:There can be a problem when using the Python (3.8.2) that ships with Xcode on Catalina. It is advised to install Python with one of the following:
- pyenv
- Homebrew
- Install Python via python.org
See detailed walk through in Appendix. Also, see pyenv install docs for further details.
NOTE: If using pyenv, make sure the python interpreter is the pyenv default, or a virtual environment has been activiated. Otherwise cmake might not be able to find the correct version of Python3 to use when building.
See Homebrew install docs for further details.
Get the latest packages:
$ brew update
Install Python:
$ brew install python
Update path:
$ echo 'export PATH="/usr/local/bin:"$PATH' >> ~/.zshrc
$ echo 'export PATH="/usr/local/bin:"$PATH' >> ~/.bash_profile
Install OpenSSL:
$ brew install openssl@1.1
To get OpenSSL to be found by cmake on macos, find where openssl was installed via homebrew:
brew info openssl@1.1
This will show you how to get it seen by pkg-config. To check that it worked, do this:
pkg-config --modversion openssl
See Mac OS install section to install SDK.
Wheels are available on Windows for Python 3.7, 3.8, 3.9 and 3.10.
Best practice is to use a Python virtual environment such as venv or pyenv (checkout the pyenv-win project) to manage multiple versions of Python.
If wanting to install from source, see the Windows building section for details.
See Windows install section to install SDK.
Back to Contents
You can always get the latest supported release version from pypi.
NOTE: If you have a recent version of pip, you may use the latest development version by issuing the following incantation:
pip install git+https://github.com/couchbase/couchbase-python-client.git
NOTE: The Python Client installer relies on PEP517 which older versions of PIP do not support. If you experience issues installing it is advised to upgrade your PIP/setuptools installation as follows:
python3 -m pip install --upgrade pip setuptools wheel
First, make sure the prerequisites have been installed.
Install the SDK:
$ python3 -m pip install couchbase
First, make sure the prerequisites have been installed.
Install the SDK:
$ python3 -m pip install couchbase
First, make sure the prerequisites have been installed.
Install the SDK:
$ python -m pip install couchbase
First, make sure the prerequisites have been installed.
NOTE: Commands assume user is working within a virtual environment. For example, the following commands have been executed after downloading and installing Python from python.org: -
C:\Users\Administrator\AppData\Local\Programs\Python\Python39\python -m venv C:\python\python39-C:\python\python39\Scripts\activate
Install the SDK (if using Python 3.7, 3.8, 3.9 or 3.10):
python -m pip install couchbase
In order to successfully install with the following methods, ensure a proper build system is in place (see the Windows building section for details).
First, ensure all the requirements for a build system are met.
Install the SDK:
python -m pip install couchbase --no-binary couchbase
First, ensure all the requirements for a build system are met.
Clone this Python SDK repository:
git clone --depth 1 --branch <tag_name> --recurse-submodules https://github.com/couchbase/couchbase-python-client.git
Where tag_name is equal to the latest release. Example:
git clone --depth 1 --branch 4.0.0 --recurse-submodules https://github.com/couchbase/couchbase-python-client.git
Move into the directory created after cloning the Python SDK repository:
cd couchbase-python-client
NOTE: If the
--recurse-submodulesoption was not used when cloning the Python SDK repository, run (after moving into the cloned repository directory)git submodule update --init --recursiveto recursively update and initialize the submodules.
Install the SDK from source:
python -m pip install .
To use the SDK within the Anaconda/Miniconda platform, make sure the prerequisites for the desired Operating System are met:
In the Anaconda Prompt, create a new environment:
(base) C:\Users\user1>conda create -n test_env python=3.9
Activate the environment
(base) C:\Users\user1>conda activate test_env
Install the SDK:
(test_env) C:\Users\user1>python -m pip install couchbase
NOTE: If using Windows, and no wheel is available, see the Alternative Install Methods Windows section. The same process should work within the Anaconda/Miniconda platform.
Back to Contents
NOTE: This section only applies to building from source.
Make sure the prerequisites have been installed:
First, make sure the prerequisites have been installed.
Install cmake:
$ brew install cmake
Install command line developer tools:
$ xcode-select --install
NOTE: It is possible that installing or updating to the the latest version of Xcode is needed.
If setuptools is not installed:
$ python -m pip install setuptools
If seeing issues when trying to build (steps in ), some things to check/try:
set VCTargetsPath=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Microsoft\VC\v160set CMAKE_GENERATOR=Visual Studio 16 2019Clone this Python SDK repository:
git clone --depth 1 --recurse-submodules https://github.com/couchbase/couchbase-python-client.git
NOTE: If the
--recurse-submodulesoption was not used when cloning the Python SDK repository, run (after moving into the cloned repository directory)git submodule update --init --recursiveto recursively update and initialize the submodules.
Move into the directory created after cloning the Python SDK repository:
cd couchbase-python-client
The following will compile the module locally:
python setup.py build_ext --inplace
You can also modify the environment CFLAGS and LDFLAGS variables.
:exclamation:WARNING: If you do not intend to install this module, ensure you set the
PYTHONPATHenvironment variable to this directory before running any scripts depending on it. Failing to do so may result in your script running against an older version of this module (if installed), or throwing an exception stating that thecouchbasemodule could not be found.
pip install .
:exclamation:WARNING: If you are on Linux/Mac OS you may need to remove the build directory:
rm -rf ./buildbefore installing with pip:pip3 install ..
Back to Contents
See official documentation for further details on connecting.
# needed for any cluster connection
from couchbase.cluster import Cluster
from couchbase.auth import PasswordAuthenticator
# options for a cluster and SQL++ (N1QL) queries
from couchbase.options import ClusterOptions, QueryOptions
# get a reference to our cluster
cluster = Cluster.connect('couchbase://localhost', ClusterOptions(
PasswordAuthenticator('Administrator', 'password')))
NOTE: The authenticator is always required.
See official documentation for further details on Working with Data.
Building upon the example code in the Connecting section:
# get a reference to our bucket
cb = cluster.bucket('travel-sample')
# get a reference to the default collection
cb_coll = cb.default_collection()
# get a document
result = cb_coll.get('airline_10')
print(result.content_as[dict])
# using SQL++ (a.k.a N1QL)
call_sign = 'CBS'
sql_query = 'SELECT VALUE name FROM `travel-sample` WHERE type = "airline" AND callsign = $1'
query_res = cluster.query(sql_query, QueryOptions(positional_parameters=[call_sign]))
for row in query_res:
print(row)
The Python Couchbase SDK supports asynchronous I/O through the use of the asyncio (Python standard library) or the Twisted async framework.
To use asyncio, import acouchbase.cluster instead of couchbase.cluster. The acouchbase API offers an API similar to the couchbase API.
import asyncio
from acouchbase.cluster import Cluster
from couchbase.options import ClusterOptions
from couchbase.auth import PasswordAuthenticator
async def write_and_read(key, value):
cluster = await Cluster.connect('couchbase://localhost',
ClusterOptions(PasswordAuthenticator('Administrator', 'password')))
cb = cluster.bucket('default')
await cb.on_connect()
cb_coll = cb.default_collection()
await cb_coll.upsert(key, value)
result = await cb_coll.get(key)
return result
rv = asyncio.run(write_and_read('foo', 'bar'))
print(rv.content_as[str])
To use with Twisted, import txcouchbase.cluster instead of couchbase.cluster. The txcouchbase API offers an API similar to the couchbase API.
NOTE: The minimum required Twisted version is 21.7.0.
:exclamation:WARNING: The 4.x SDK introduced a breaking change where the txcouchbase package must be imported prior to importing the reactor (see example below). This is so that the asyncio reactor can be installed.
# IMPORTANT -- the txcouchbase import must occur PRIOR to importing the reactor
import txcouchbase
from twisted.internet import reactor, defer
from txcouchbase.cluster import TxCluster
from couchbase.options import ClusterOptions
from couchbase.auth import PasswordAuthenticator
def after_upsert(res, key, d):
print('Set key. Result CAS: ', res.cas)
# trigger get_document callback
d.callback(key)
def upsert_document(key, doc):
d = defer.Deferred()
res = cb.upsert(key, doc)
res.addCallback(after_upsert, key, d)
return d
def on_get(res, _type=str):
print('Got res: \n', res.content_as[_type])
reactor.stop()
def get_document(key):
res = cb.get(key)
res.addCallback(on_get)
# create a cluster object
cluster = TxCluster('couchbase://localhost',
ClusterOptions(PasswordAuthenticator('Administrator', 'password')))
# create a bucket object
bucket = cluster.bucket('default')
# create a collection object
cb = bucket.default_collection()
d = upsert_document('testDoc_1', {'id': 1, 'type': 'testDoc', 'info': 'fake document'})
d.addCallback(get_document)
reactor.run()
Back to Contents
The Couchbase Python SDK provides comprehensive logging for debugging and monitoring.
Enable logging via environment variable:
$ export PYCBC_LOG_LEVEL=info
$ python your_app.py
Or configure programmatically:
import logging
from couchbase import configure_logging
configure_logging('my_app', level=logging.DEBUG)
For complete logging documentation including configuration options, examples, troubleshooting, and best practices, see LOGGING.md.
For working example scripts demonstrating various logging configurations, see examples/logging/.
Back to Contents
Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.