Skip to content

Instantly share code, notes, and snippets.

@var23rav
Last active October 28, 2018 19:05
Show Gist options
  • Save var23rav/986e05903d4b98cf80cc813b04688953 to your computer and use it in GitHub Desktop.
Save var23rav/986e05903d4b98cf80cc813b04688953 to your computer and use it in GitHub Desktop.
Workaround for installing couchbase in windows

Workaround for python couchbase library installation in Windows

If you are facing the libcouchbase issues, while installing couchbase library using

    pip install couchbase

Follow the below step to install couchbase.

  1. clone python coucbase source file from

     https://github.com/couchbase/couchbase-python-client.git
    
  2. Download libcouchbase c-sdk binary files from

     https://developer.couchbase.com/server/other-products/release-notes-archives/c-sdk
    
  3. Update the setup.py file.

    Update the library_dirs & include_dirs location to the proper libcouchbase version

     extoptions['library_dirs'] = [r'C:\Users\vaisakh\Downloads\libcouchbase-{version}\lib']
    
     extoptions['include_dirs'] = [r'C:\Users\vaisakh\Downloads\libcouchbase-{version}\include')]
    
  4. Goto cloned python coucbase source code folder 'couchbase-python-client' and execute.

    It will build header files(_libcouchbase.pyd and others) in couchbase folder.

     python setup.py build_ext --inplace
    
  5. If the u face the .dll file misssing error.

    Include libcouchbase.dll from libcouchbase c-sdk binary files inside couchbase folder.

     C:\Users\vaisakh\Downloads\libcouchbase-{version}\lib
    
  6. Now it will update the couchbase folder

  7. Copy this folder and paste it in the python(if virutal environment enabled, its) site-packages location

    eg: C:\Users\vaisakh\AppData\Local\Continuum\Anaconda2\envs\envCaroami\Lib\site-packages

    Note: use the python command to find the site-packages location

  8. Using pip freez u may not able to view couchbase listed in installed packages.

    But we can verify availability of couchbase by import couchbase command in python console.

    import site; site.getsitepackages()
    
@SouadAmg
Copy link

Hello,
When I execute setup.py , I get the following error :

setup.py:91: UserWarning: I'm detecting you're running windows.You might want to
modify the 'setup.py' script to use appropriate paths
warnings.warn("I'm detecting you're running windows."
running build_ext
building 'couchbase._libcouchbase' extension
Traceback (most recent call last):
File "setup.py", line 204, in
**setup_kw
File "C:\Program Files\Python34\lib\distutils\core.py", line 148, in setup
dist.run_commands()
File "C:\Program Files\Python34\lib\distutils\dist.py", line 955, in run_commands
self.run_command(cmd)
File "C:\Program Files\Python34\lib\distutils\dist.py", line 974, in run_command
cmd_obj.run()
File "C:\Program Files\Python34\lib\site-packages\setuptools\command\build_ext.py", line 49, in run
_build_ext.run(self)
File "C:\Program Files\Python34\lib\distutils\command\build_ext.py", line 339,
in run
self.build_extensions()
File "C:\Program Files\Python34\lib\distutils\command\build_ext.py", line 448,
in build_extensions
self.build_extension(ext)
File "C:\Program Files\Python34\lib\site-packages\setuptools\command\build_ext
.py", line 174, in build_extension
_build_ext.build_extension(self, ext)
File "C:\Program Files\Python34\lib\distutils\command\build_ext.py", line 503,
in build_extension
depends=ext.depends)
File "C:\Program Files\Python34\lib\distutils\msvc9compiler.py", line 460, in
compile
self.initialize()
File "C:\Program Files\Python34\lib\distutils\msvc9compiler.py", line 371, in
initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\Program Files\Python34\lib\site-packages\setuptools\msvc9_support.py"
, line 52, in query_vcvarsall
return unpatched['query_vcvarsall'](version, *args, **kwargs)
File "C:\Program Files\Python34\lib\distutils\msvc9compiler.py", line 287, in
query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: ['path']

setuperror

Could you please help me ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment