3
votes

I'm trying to install the couchbase python package on Centos7. Both libcouchbase and the Python client appear to build and install without issue, but when I attempt to import the module in the interpreter, I get:

Python 3.4.3 (default, Oct  6 2015, 15:22:55) 
[GCC 4.8.3 20140911 (Red Hat 4.8.3-9)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import couchbase
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.4/site-packages/couchbase-2.0.4-py3.4-linux-x86_64.egg/couchbase/__init__.py", line 28, in <module>
    from couchbase.user_constants import *
  File "/usr/local/lib/python3.4/site-packages/couchbase-2.0.4-py3.4-linux-x86_64.egg/couchbase/user_constants.py", line 21, in <module>
    import couchbase._bootstrap
  File "/usr/local/lib/python3.4/site-packages/couchbase-2.0.4-py3.4-linux-x86_64.egg/couchbase/_bootstrap.py", line 34, in <module>
    import couchbase.exceptions as E
  File "/usr/local/lib/python3.4/site-packages/couchbase-2.0.4-py3.4-linux-x86_64.egg/couchbase/exceptions.py", line 18, in <module>
    import couchbase._libcouchbase as C
ImportError: libcouchbase.so.2: cannot open shared object file: No such file or directory

I'm building libcouchbase:

cd /
git clone git://github.com/couchbase/libcouchbase.git
cd libcouchbase
mkdir build
/libcouchbase/cmake/configure
make && make install

to build the python package:

cd /usr/local/lib/python3.4/site-packages
git clone git://github.com/couchbase/couchbase-python-client
cd couchbase-python-client
python3.4 setup.py build_ext --inplace --library-dir /usr/local/lib --include-dir /usr/local/include/libcouchbase
python3.4 setup.py install

I have also tried setup.py build without the flags.

PYTHONPATH:

/usr/local/lib/python3.4/site-packages/couchbase-2.0.4-py3.4-linux-x86_64.egg
/usr/local/lib/python34.zip
/usr/local/lib/python3.4
/usr/local/lib/python3.4/plat-linux
/usr/local/lib/python3.4/lib-dynload
/usr/local/lib/python3.4/site-packages

$PATH

/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
1
Have tried symlinking the 2, but it doesn't work. - puffin
I tried the perl script at one point and it didn't work. I've possibly resolved some dependency issues since then. This works. I'll accept it if you add it as the answer. Cheers! - puffin

1 Answers

1
votes

You should add /usr/local/lib into LD_LIBRARY_PATH.

Run command in shell:

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib