Uploaded image for project: 'Couchbase Python Client Library'
  1. Couchbase Python Client Library
  2. PYCBC-869

Cattrs library doesn't work with python 3.5.2



    • Bug
    • Resolution: Fixed
    • Critical
    • 3.0.0
    • 3.0.0-rc
    • None
    • None
    • 1
    • SDK13: Coll/Txn/Docs More Chip


      Currently, our performance testing framework uses python 3.5.2. I was trying to test out the latest python sdk 3.0.0 in our perf framework to see if there are any issues. I ran pip install git+https://github.com/couchbase/couchbase-python-client.git as recommended. I then tried to run 

      from couchbase.exceptions import CouchbaseError

      I did this on two setups: osx with python 3.5.6 and ubuntu with python 3.5.2. In both cases it throws import error:

      Ubuntu -

      Python 3.5.2 (default, Oct  8 2019, 13:06:37) 
      [GCC 5.4.0 20160609] on linux
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from couchbase.exceptions import CouchbaseError
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "/tmp/perfrunner/perfrunner/env/lib/python3.5/site-packages/couchbase/__init__.py", line 3, in <module>
          from .bucket import *
        File "/tmp/perfrunner/perfrunner/env/lib/python3.5/site-packages/couchbase/bucket.py", line 1, in <module>
          from couchbase.management import CollectionManager, ViewIndexManager
        File "/tmp/perfrunner/perfrunner/env/lib/python3.5/site-packages/couchbase/management/__init__.py", line 1, in <module>
          from .collections import CollectionManager
        File "/tmp/perfrunner/perfrunner/env/lib/python3.5/site-packages/couchbase/management/collections.py", line 1, in <module>
          from ..options import OptionBlockTimeOut, forward_args
        File "/tmp/perfrunner/perfrunner/env/lib/python3.5/site-packages/couchbase/options.py", line 14, in <module>
          import cattr
        File "/tmp/perfrunner/perfrunner/env/lib/python3.5/site-packages/cattr/__init__.py", line 2, in <module>
          from .converters import Converter, UnstructureStrategy
        File "/tmp/perfrunner/perfrunner/env/lib/python3.5/site-packages/cattr/converters.py", line 15, in <module>
          from ._compat import (
        File "/tmp/perfrunner/perfrunner/env/lib/python3.5/site-packages/cattr/_compat.py", line 87, in <module>
          from typing import _Union
      ImportError: cannot import name '_Union'

      OSX - 

      Python 3.5.6 (default, May 13 2019, 15:48:34) 
      [GCC 4.2.1 Compatible Apple LLVM 8.1.0 (clang-802.0.42)] on darwin
      Type "help", "copyright", "credits" or "license" for more information.
      >>> from couchbase.exceptions import CouchbaseError
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
      ImportError: cannot import name 'CouchbaseError'

      Not sure why osx python didnt provide stacktrace.

      Certain version of python do not have  typing._Union and this is a known issue with Cattrs:



      Cattrs incompatibility is not just for the version I mentioned, 3.5.2 and 3.5.6, but others as well. It seems there are possible work arounds you can implement. Until this is fixed perf team cannot run any tests on latests python sdk. Alternative workaround for perf team would be to upgrade our python version however this is a large task and we would prefer if this is fixed in the sdk.



        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            Ellis.Breen Ellis Breen
            korrigan.clark Korrigan Clark (Inactive)
            0 Vote for this issue
            3 Start watching this issue



              Gerrit Reviews

                There are no open Gerrit changes