Hi @zephyr91 – If you check out the compat docs, we list what versions are supported by the SDK. The prereqs are mentioned here (select the appropriate OS tab).
I fired up an Ubuntu 20.04 EC2 instance. Here are the steps I followed:
OS Info:
ubuntu@ip-172-31-29-195:~$ cat /etc/os-release
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Default Python version:
ubuntu@ip-172-31-29-195:~$ python3 -V
Python 3.8.10
Basic update and packages:
ubuntu@ip-172-31-29-195:~$ sudo apt-get update -y
ubuntu@ip-172-31-29-195:~$ sudo apt-get install -y git-all wget vim zip unzip
Install prereqs to build Python:
ubuntu@ip-172-31-29-195:~$ sudo apt-get install -y libffi-dev build-essential libssl-dev make zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libreadline-dev
Build Python 3.12.4
ubuntu@ip-172-31-29-195:~$ export PYTHON_VERSION=3.12.4
ubuntu@ip-172-31-29-195:~$ cd /usr/src
ubuntu@ip-172-31-29-195:/usr/src$ sudo wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz
ubuntu@ip-172-31-29-195:/usr/src$ sudo tar -xf Python-$PYTHON_VERSION.tgz
ubuntu@ip-172-31-29-195:/usr/src$ cd Python-$PYTHON_VERSION
ubuntu@ip-172-31-29-195:/usr/src/Python-3.12.4$ sudo ./configure --enable-optimizations
ubuntu@ip-172-31-29-195:/usr/src/Python-3.12.4$ sudo make -j 2 && sudo make altinstall
Cleanup:
ubuntu@ip-172-31-29-195:/usr/src/Python-3.12.4$ cd ..
ubuntu@ip-172-31-29-195:/usr/src$ sudo rm -rf Python-$PYTHON_VERSION
ubuntu@ip-172-31-29-195:/usr/src$ sudo rm Python-$PYTHON_VERSION.tgz
Verify:
ubuntu@ip-172-31-29-195:/usr/src$
ubuntu@ip-172-31-29-195:~$ python3.12 -V
Python 3.12.4
Setup & activate virtual env:
ubuntu@ip-172-31-29-195:~$ python3.12 -m venv /tmp/cb4x-py3.12.4
ubuntu@ip-172-31-29-195:~$ source /tmp/cb4x-py3.12.4
-bash: source: /tmp/cb4x-py3.12.4: is a directory
ubuntu@ip-172-31-29-195:~$ source /tmp/cb4x-py3.12.4/bin/activate
(cb4x-py3.12.4) ubuntu@ip-172-31-29-195:~$ python3 -V
Python 3.12.4
Install Couchbase SDK prereqs:
(cb4x-py3.12.4) ubuntu@ip-172-31-29-195:~$ python3 -m pip install --upgrade pip setuptools wheel
Install Couchbase SDK:
Can use -v -v -v
or --log <path to log file>
for verbose output. I like having the log file
(cb4x-py3.12.4) ubuntu@ip-172-31-29-195:~$ python3 -m pip install couchbase --no-binary couchbase --log /tmp/couchbase_python_sdk_install.log
Collecting couchbase
Downloading couchbase-4.2.1.tar.gz (6.6 MB)
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.6/6.6 MB 15.2 MB/s eta 0:00:00
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing metadata (pyproject.toml) ... done
Building wheels for collected packages: couchbase
Building wheel for couchbase (pyproject.toml) ... done
Created wheel for couchbase: filename=couchbase-4.2.1-cp312-cp312-linux_x86_64.whl size=105556816 sha256=42d9cc67fd72c169404238d5dec51440e5ef0f463165864467b5c027d2019132
Stored in directory: /home/ubuntu/.cache/pip/wheels/73/86/3c/a7357825ec2250b0cdf68f84017f68b87a5ce6054566aef7c5
Successfully built couchbase
Installing collected packages: couchbase
Successfully installed couchbase-4.2.1
Verify SDK is installed:
(cb4x-py3.12.4) ubuntu@ip-172-31-29-195:~$ python3 -m pip show couchbase
Name: couchbase
Version: 4.2.1
Summary: Python Client for Couchbase
Home-page: https://github.com/couchbase/couchbase-python-client
Author: Couchbase, Inc.
Author-email: PythonPackage@couchbase.com
License: Apache License 2.0
Location: /tmp/cb4x-py3.12.4/lib/python3.12/site-packages
Requires:
Required-by:
Verify SDK is functioning:
(cb4x-py3.12.4) ubuntu@ip-172-31-29-195:~$ python3 -c "from couchbase import get_metadata;import pprint;pprint.pprint(get_metadata(detailed=True))"
{'__cplusplus': '201703',
'asio': '1.29.0',
'build_timestamp': '2024-06-18 02:02:07',
'cc': 'GNU 9.4.0',
'cmake_build_type': 'Release',
'cmake_version': '3.29.5',
'compile_definitions': 'HAVE_BACKTRACE=1;HAVE_DLADDR=1;_GNU_SOURCE=1;SPDLOG_COMPILED_LIB;SPDLOG_FMT_EXTERNAL;ASIO_STANDALONE;ASIO_NO_DEPRECATED',
'compile_features': 'cxx_std_17;cxx_std_11;cxx_std_17;cxx_std_17',
'compile_flags': '',
'compile_options': '-fdiagnostics-color=always;-ggdb3',
'cpu': 'x86_64',
'cxx': 'GNU 9.4.0',
'fmt': '10.2.1',
'hdr_histogram_c': '0.11.8',
'libc': 'glibc 2.31',
'link_depends': '',
'link_flags': '',
'link_libraries': 'project_options;project_warnings;fmt::fmt;spdlog::spdlog;couchbase_backtrace;couchbase_logger;couchbase_platform;couchbase_meta;couchbase_crypto;couchbase_sasl;couchbase_tracing;couchbase_metrics;Microsoft.GSL::GSL;asio;llhttp::llhttp;taocpp::json;snappy;jsonsl;hdr_histogram_static',
'link_options': '',
'llhttp': '9.2.0',
'mozilla_ca_bundle_date': 'Mon Mar 11 15:25:27 2024 GMT',
'mozilla_ca_bundle_embedded': True,
'mozilla_ca_bundle_sha256': '1794c1d4f7055b7d02c2170337b61b48a2ef6c90d77e95444fd2596f4cac609f',
'mozilla_ca_bundle_size': 147,
'openssl_config_dir': '/usr/lib/ssl',
'openssl_crypto_interface_imported_location': '/usr/lib/x86_64-linux-gnu/libcrypto.so',
'openssl_crypto_interface_include_directories': '/usr/include',
'openssl_crypto_interface_link_libraries': '',
'openssl_default_cert_dir': '/usr/lib/ssl/certs',
'openssl_default_cert_dir_env': 'SSL_CERT_DIR',
'openssl_default_cert_file': '/usr/lib/ssl/cert.pem',
'openssl_default_cert_file_env': 'SSL_CERT_FILE',
'openssl_headers': 'OpenSSL 1.1.1f 31 Mar 2020',
'openssl_pkg_config_interface_include_directories': '',
'openssl_pkg_config_interface_link_libraries': '',
'openssl_runtime': 'OpenSSL 1.1.1f 31 Mar 2020',
'openssl_ssl_imported_location': '/usr/lib/x86_64-linux-gnu/libssl.so',
'openssl_ssl_interface_include_directories': '/usr/include;/usr/include',
'openssl_ssl_interface_link_libraries': 'OpenSSL::Crypto',
'platform': 'Linux-5.15.0-1047-aws',
'platform_name': 'Linux',
'platform_version': '5.15.0-1047-aws',
'post_linked_openssl': 'ON',
'revision': '',
'semver': '1.0.0+',
'snappy': '1.1.10',
'snapshot': False,
'spdlog': '1.13.0',
'static_boringssl': 'false',
'static_openssl': False,
'static_stdlib': False,
'txns_forward_compat_extensions': 'TI,MO,BM,QU,SD,BF3787,BF3705,BF3838,RC,UA,CO,BF3791,CM,SI,QC,IX,TS,PU',
'txns_forward_compat_protocol_version': '2.0',
'version': '1.0.0',
'version_build': 0,
'version_major': 1,
'version_minor': 0,
'version_patch': 0}