Couchbase Python SDK 2.5.3 Installation

I had installed python sdk in build machine and copied all installed files in another couchbase node and tried to use sdk. I am getting below error for

from couchbase.user_constants import *
File “/DG/activeRelease/lib/python_lib/couchbase/”, line 21, in <module> import couchbase._bootstrap File “/DG/activeRelease/lib/python_lib/couchbase/”, line 34, in <module> import couchbase.exceptions as E File “/DG/activeRelease/lib/python_lib/couchbase/”, line 18, in <module> import couchbase._libcouchbase as C
ImportError: /DG/activeRelease/lib/python_lib/couchbase/ undefined symbol: lcbtrace_span_get_operation

And I have used import as below:

import sys

from couchbase.bucket import Bucket
from couchbase.views.params import Query
from couchbase.exceptions import CouchbaseError
from couchbase.exceptions import NotFoundError

The same code works for couchbase python sdk 2.3.2

@Arihant, what’s the underlying version of Libcouchbase that you have installed?

Assuming that you have also installed the CLI tools for Libcouchbase, you can find this out by running:

cbc version

Hi @Arihant, you need libcouchbase 2.9.0 or greater to run recent Couchbase Python clients. Looks like you have an older version on this machine?

I strengthened the checks in the C bindings for the client, so that they inform you of the need to upgrade during compilation, but as you copied the compiled extension across, you will not have seen this error.

I will see if I can add some more explanatory error message when the C extension is pulled in, although it would likely require a multi-phase loading process as the C extension pulls in newer API calls. There’s another JIRA related to this here:



Please find the output of cbc version

Runtime: Version=2.8.7, Changeset=081e8b16b991bf706eb77f8243935c6fba31b895
Headers: Version=2.8.7, Changeset=081e8b16b991bf706eb77f8243935c6fba31b895
IO: Default=libevent, Current=select, Accessible=select
SSL Runtime: OpenSSL 1.0.1e-fips 11 Feb 2013
SSL Headers: OpenSSL 1.0.1e-fips 11 Feb 2013
Snappy: 1.1.1
System: Linux-3.13.0-151-generic; x86_64
CC: GNU 7.3.0; -g -std=gnu99 -Wall -pedantic -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -fno-strict-aliasing -Wno-overlength-strings -fvisibility=hidden -pthread -fno-strict-aliasing -pthread
CXX: GNU 7.3.0; -std=c++11 -g -Wall -Wredundant-decls -Wmissing-braces -fno-strict-aliasing -Wno-aligned-new -Wno-stringop-overflow -pedantic -fvisibility=hidden -pthread -Werror=switch -fno-strict-aliasing -pthread

Runtime: Version=2.8.7, Changeset=081e8b16b991bf706eb77f8243935c6fba31b895
Headers: Version=2.8.7, Changeset=081e8b16b991bf706eb77f8243935c6fba31b895

This indicates the target system has libcouchbase 2.8.7. You need to upgrade to at least libcouchbase 2.9.0. Preferably the latest version (2.10.3 at time of writing).



Thanks @ellis.breen. Looks like default couchbase 6.0 installation does not have latest libcouchbase. I will install and try.

1 Like

Hi @arihant,

That’s surprising - will follow that one up. Hopefully upgrading will resolve this for now.



Note that we package/ship libcouchbase separately from the cluster. Generally when doing Python development, you’ll want to install that (as the instructions indicate) since it is updated at a more regular cadence and that package puts headers/etc. in the right place for development.