Installing Python SDK 3 in windows 10

Hi,

I am following the instructions from https://docs.couchbase.com/python-sdk/3.0/hello-world/start-using-sdk.html to install sdk 3 of couchbase on my Windows machine but facing issue while running “python -m pip install couchbase” command.
This is the output error log after I run pip install command for couchbase:

random-things/c3-venv/Scripts/python.exe’]
Traceback (most recent call last):
File “C:\Users\dagarwal\Flipt-Projects\random-things\c3-venv\lib\site-packages\pip_vendor\pep517_in_process.py”, line 280, in
main()
File “C:\Users\dagarwal\Flipt-Projects\random-things\c3-venv\lib\site-packages\pip_vendor\pep517_in_process.py”, line 263, in main
json_out[‘return_val’] = hook(**hook_input[‘kwargs’])
File “C:\Users\dagarwal\Flipt-Projects\random-things\c3-venv\lib\site-packages\pip_vendor\pep517_in_process.py”, line 205, in build_wheel
metadata_directory)
File “C:\Users\dagarwal\AppData\Local\Temp\pip-build-env-gecl74h1\overlay\Lib\site-packages\setuptools\build_meta.py”, line 212, in build_wheel
wheel_directory, config_settings)
File “C:\Users\dagarwal\AppData\Local\Temp\pip-build-env-gecl74h1\overlay\Lib\site-packages\setuptools\build_meta.py”, line 197, in build_with_temp_dir
self.run_setup()
File “C:\Users\dagarwal\AppData\Local\Temp\pip-build-env-gecl74h1\overlay\Lib\site-packages\setuptools\build_meta.py”, line 249, in run_setup
self).run_setup(setup_script=setup_script)
File “C:\Users\dagarwal\AppData\Local\Temp\pip-build-env-gecl74h1\overlay\Lib\site-packages\setuptools\build_meta.py”, line 142, in run_setup
exec(compile(code, file, ‘exec’), locals())
File “setup.py”, line 94, in
**setup_kw
File "C:\Users\dagarwal\AppData\Local\Temp\pip-build-env-gecl74h1\overlay\Lib\site-packages\setuptools_init
.py", line 165, in setup
return distutils.core.setup(**attrs)
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\core.py”, line 148, in setup
dist.run_commands()
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py”, line 955, in run_commands
self.run_command(cmd)
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py”, line 974, in run_command
cmd_obj.run()
File “C:\Users\dagarwal\AppData\Local\Temp\pip-build-env-gecl74h1\overlay\Lib\site-packages\wheel\bdist_wheel.py”, line 223, in run
self.run_command(‘build’)
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py”, line 974, in run_command
cmd_obj.run()
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\command\build.py”, line 135, in run
self.run_command(cmd_name)
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\cmd.py”, line 313, in run_command
self.distribution.run_command(command)
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\dist.py”, line 974, in run_command
cmd_obj.run()
File “C:\Users\dagarwal\AppData\Local\Temp\pip-install-9hqvelgo\couchbase\cmake_build.py”, line 62, in run
build_ext.run(self)
File “C:\Users\dagarwal\AppData\Local\Temp\pip-build-env-gecl74h1\overlay\Lib\site-packages\setuptools\command\build_ext.py”, line 87, in run
_build_ext.run(self)
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\command\build_ext.py”, line 339, in run
self.build_extensions()
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\command\build_ext.py”, line 448, in build_extensions
self._build_extensions_serial()
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\distutils\command\build_ext.py”, line 473, in _build_extensions_serial
self.build_extension(ext)
File “C:\Users\dagarwal\AppData\Local\Temp\pip-install-9hqvelgo\couchbase\cbuild_config.py”, line 257, in build_extension
self.prep_build(ext)
File “C:\Users\dagarwal\AppData\Local\Temp\pip-install-9hqvelgo\couchbase\cmake_build.py”, line 183, in prep_build
cwd=self.build_temp)
File “C:\Users\dagarwal\AppData\Local\Programs\Python\Python36\lib\subprocess.py”, line 311, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command ‘[‘cmake’, ‘–build’, ‘.’, ‘–config’, ‘Release’, ‘–’, ‘/m’]’ returned non-zero exit status 1.

ERROR: Failed building wheel for couchbase
Failed to build couchbase
ERROR: Could not build wheels for couchbase which use PEP 517 and cannot be installed directly

Can someone please help with this?
I am using Python 3.6.8
PS: I have upgraded pip, setuptools and wheel package as mentioned in the documentation.

Hi, this looks like a known issue, fixed in 3.0.4 which is due soon. In the meantime, you can install 3.0.4b1 as follows:

pip install couchbase==3.0.4b1

Let us know if that fixes the issue for you. Thanks!

Hi Ellis,

Thank you for your reply!

I just tried that but ran into same error.
Error happens when it tries to -

Building wheels for collected packages: couchbase
Building wheel for couchbase (PEP 517) … error
ERROR: Command errored out with exit status 1:

Also, just a fyi: couchbase sdk 2.5.4 is running fine on my system.

Hi, please run:

pip install couchbase==3.0.4b1  -v -v -v > build_log_304b1.txt 2>&1

Please also try:

pip install couchbase==3.0.1  -v -v -v > build_log_301.txt 2>&1

And send us the output (GDrive links are fine).

Thanks,

Ellis

Sure, please find google drive link for both the files:

301:

304b1

Ah, didn’t spot this was on Windows. There are some extra prerequisites there if a binary wheel is not available (which is the case for Python <3.7). We are working on building a greater variety of binary wheels on our CI systems but this is currently a work in progress.

We’d therefore encourage you to upgrade to 3.7 or above.

However, if you still want to use 3.6, you’ll need the relevant compiler binary here: https://wiki.python.org/moin/WindowsCompilers#Microsoft_Visual_C.2B-.2B-_14.2_standalone:Build_Tools_for_Visual_Studio_2019.28x86.2C_x64.2C_ARM.2C_ARM64.29 plus the Python headers for the exact version of 3.6 you are using (the Python.org web installer for Windows provides these) before trying to install.

Hope that helps,

Ellis

Thanks for the info!
I installed visual c libraries from the link given above and also did a fresh install of Python 3.6.8 (assuming python headers will be updated with this).

But still upon trying to install couchbase I am getting same error.
Is there a way by which you can verify I have correct binaries and python headers?

Thanks,
Devansh

Hi, you need the full installer for Python - this should by default install headers/development libs - https://docs.python.org/3/using/windows.html#windows-full (this should also be specifiable from the command line with Include-dev=1). These should end up in your %PYTHONHOME%\include and %PYTHONHOME\lib directories in a correctly activated Python environment.

Hi, this is the relevant error message:

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK version in the project property pages or by right-clicking the solution and selecting "Retarget solution"

You need to ensure that the VC140 toolset is activated in the environment you run install from - easiest to do this by running the relevant VC140 Command Prompt script from the Start Menu, activating the right Python from within that, then running python setup.py bdist_wheel to build the binary wheel in dist.

Thanks,

Ellis

Hi, I am facing the same error, I am using windows 10, python 3.7.4 and when I’m trying to install sdk3 of couchbase an error relating the build of the wheel appears, I’ve tried verious version discussed in this topic and in the similar ones but none seems to work for me, this is my error log, can someone please help me?