Cassandra
  1. Cassandra
  2. CASSANDRA-10255

AttributeError: 'module' object has no attribute 'compress'

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Fix Version/s: 2.1.x
    • Component/s: Configuration, Packaging
    • Labels:
    • Environment:

      Linux fedora 21

    • Flags:
      Important
    • Since Version:

      Description

      Hi Recently i have upgrade my server from cassandra version 2.0.11 to 2.1.8 using tarball installation.And i have added one node to existing culster with the same version of 2.1.8. All the configuration settings are done but am not able to run cqlsh from bin directory.and this is the error
      AttributeError: 'module' object has no attribute 'compress'

      ./cqlsh
      Traceback (most recent call last):
       File "./cqlsh", line 111, in <module>
          from cassandra.cluster import Cluster, PagedResult
      File "/home/cassandra/apache-cassandra-2.1.8/bin/../lib/cassandra-driver-internal-only-2.6.0c2.post.zip/cassandra-driver-2.6.0c2.post/cassandra/cluster.py", line 49, in <module>
       File "/home/cassandra/apache-cassandra-2.1.8/bin/../lib/cassandra-driver-internal-only-2.6.0c2.post.zip/cassandra-driver-2.6.0c2.post/cassandra/connection.py", line 88, in <module>
      AttributeError: 'module' object has no attribute 'compress'
      
      1. error.jpeg
        45 kB
        navithejesh
      2. erroe2.jpeg
        31 kB
        navithejesh

        Activity

        Hide
        Tyler Hobbs added a comment -

        I think that's failing on using snappy.compress after successfully importing snappy. Do you have an old snappy python library installed, perhaps?

        Show
        Tyler Hobbs added a comment - I think that's failing on using snappy.compress after successfully importing snappy . Do you have an old snappy python library installed, perhaps?
        Hide
        navithejesh added a comment - - edited

        Hi Tyler,

        Firstly i would like to thank you for reply......

        In our set-up there are two systems A and B
        --> Initially, A was the single node previously, having data of 167.44GB and recently upgraded from Apache Cassandra 2.0.11 to 2.1.8
        --> B is the new node with Apache Cassandra 2.1.8
        --> we made two machines up and created cluster between A and B. All the data is shared and when i run ./nodetool status in node A it is showing A is having 167.44 GB of data and node B is showing 553.77GB.
        --> In node A we installed lz4 and python-snappy before loading data and in node B we didn't.
        --> when i run ./cqlsh on node B, am not able to run it and its throwing an error like AttributeError: 'module' object has no attribute 'compress'
        --> Later i understood that i haven't installed lz4 and python-snappy in node B.
        --> Now i installed and lz4 and python-snappy libraries and started Cassandra service in node B.But still it shows the same error.
        --> And also we find differences in data sizes in both, the node A (167.44GB which is seed node) and node B (553.77GB ) we don't understand the reason behind this.
        --> Check the attachment error2.xcf

        Show
        navithejesh added a comment - - edited Hi Tyler, Firstly i would like to thank you for reply...... In our set-up there are two systems A and B --> Initially, A was the single node previously, having data of 167.44GB and recently upgraded from Apache Cassandra 2.0.11 to 2.1.8 --> B is the new node with Apache Cassandra 2.1.8 --> we made two machines up and created cluster between A and B. All the data is shared and when i run ./nodetool status in node A it is showing A is having 167.44 GB of data and node B is showing 553.77GB. --> In node A we installed lz4 and python-snappy before loading data and in node B we didn't. --> when i run ./cqlsh on node B, am not able to run it and its throwing an error like AttributeError: 'module' object has no attribute 'compress' --> Later i understood that i haven't installed lz4 and python-snappy in node B. --> Now i installed and lz4 and python-snappy libraries and started Cassandra service in node B.But still it shows the same error. --> And also we find differences in data sizes in both, the node A (167.44GB which is seed node) and node B (553.77GB ) we don't understand the reason behind this. --> Check the attachment error2.xcf
        Hide
        Tyler Hobbs added a comment -

        Let's keep this ticket focused on the AttributeError since the data sizes are unrelated.

        After you installed python-snappy on node B, did the error remain the same? Did you install snappy with pip? If so, were there any errors during the installation?

        Can you run the following and paste the results?

        python -c 'import snappy; print dir(snappy); print snappy.__file__'
        
        Show
        Tyler Hobbs added a comment - Let's keep this ticket focused on the AttributeError since the data sizes are unrelated. After you installed python-snappy on node B, did the error remain the same? Did you install snappy with pip? If so, were there any errors during the installation? Can you run the following and paste the results? python -c 'import snappy; print dir(snappy); print snappy.__file__'
        Hide
        navithejesh added a comment -

        -->After you installed python-snappy on node B, did the error remain the same?
        Yes the error remain same even after installing snappy using pip.

        -->Did you install snappy with pip?
        yes.

        -->If so, were there any errors during the installation?
        Yes,There was an error while installing snappy.

        [root@localhost bin]# pip install python-snappy
        Collecting python-snappy
        Using cached python-snappy-0.5.tar.gz
        Installing collected packages: python-snappy
        Running setup.py install for python-snappy
        Complete output from command /usr/bin/python -c "import setuptools, tokenize;_file='/tmp/pip-build-5yOKl1/python-snappy/setup.py';exec(compile(getattr(tokenize, 'open', open)(file).read().replace('\r\n', '\n'), __file_, 'exec'))" install --record /tmp/pip-moLktZ-record/install-record.txt --single-version-externally-managed --compile:
        running install
        running build
        running build_py
        creating build
        creating build/lib.linux-x86_64-2.7
        copying snappy.py -> build/lib.linux-x86_64-2.7
        running build_ext
        building '_snappy' extension
        creating build/temp.linux-x86_64-2.7
        gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c snappymodule.cc -o build/temp.linux-x86_64-2.7/snappymodule.o
        snappymodule.cc:31:22: fatal error: snappy-c.h: No such file or directory
        #include <snappy-c.h>
        ^
        compilation terminated.
        error: command 'gcc' failed with exit status 1

        --> Then i installed snappy-master manually and after that i didn't get any errors while installing python-snappy.

        -->Can you run the following and paste the results?

        python -c 'import snappy; print dir(snappy); print snappy._file_' ?

        This was the message shown by python -c 'import snappy; print dir(snappy); print snappy._file_'

        [root@localhost bin]# python -c 'import snappy; print dir(snappy); print snappy._file_'
        ['AbelianGroup', 'AlternatingKnotExteriors', 'CensusKnots', 'Crossing', 'CuspNeighborhood', 'CuspNeighborhoodHP', 'CyOpenGL', 'DTcodec', 'DirichletDomain', 'DirichletDomainHP', 'FXrays', 'FundamentalGroup', 'HTLinkExteriors', 'HolonomyGroup', 'HolonomyGroupHP', 'IdentityBraid', 'InfinityTangle', 'Link', 'LinkExteriors', 'Manifold', 'ManifoldHP', 'NonalternatingKnotExteriors', 'NonorientableClosedCensus', 'NonorientableCuspedCensus', 'OrientableClosedCensus', 'OrientableCuspedCensus', 'RationalTangle', 'SnapPeaFatalError', 'SnapPy', 'SnapPyHP', 'SnapPy_doc', 'Strand', 'SymmetryGroup', 'Tangle', 'Triangulation', 'TriangulationHP', 'ZeroTangle', '_ManifoldHP', '_ManifoldLP', '_TriangulationHP', '_TriangulationLP', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '__version__', '_link_exterior', '_within_sage', 'app_menus', 'browser', 'canonical_retriangulation', 'database', 'database_objects', 'db_utilities', 'filedialog', 'horoviewer', 'infodialog', 'isometry_signature', 'link_objects', 'manifolds', 'method', 'mfld_class', 'number', 'pari', 'polyviewer', 'ptolemy', 'release_info', 'sage_helper', 'snap', 'snappy', 'theme', 'twister', 'verify', 'version']
        /usr/lib64/python2.7/site-packages/snappy/_init_.pyc

        Show
        navithejesh added a comment - -->After you installed python-snappy on node B, did the error remain the same? Yes the error remain same even after installing snappy using pip. -->Did you install snappy with pip? yes. -->If so, were there any errors during the installation? Yes,There was an error while installing snappy. [root@localhost bin] # pip install python-snappy Collecting python-snappy Using cached python-snappy-0.5.tar.gz Installing collected packages: python-snappy Running setup.py install for python-snappy Complete output from command /usr/bin/python -c "import setuptools, tokenize;_ file ='/tmp/pip-build-5yOKl1/python-snappy/setup.py';exec(compile(getattr(tokenize, 'open', open)( file ).read().replace('\r\n', '\n'), __file _, 'exec'))" install --record /tmp/pip-moLktZ-record/install-record.txt --single-version-externally-managed --compile: running install running build running build_py creating build creating build/lib.linux-x86_64-2.7 copying snappy.py -> build/lib.linux-x86_64-2.7 running build_ext building '_snappy' extension creating build/temp.linux-x86_64-2.7 gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/include/python2.7 -c snappymodule.cc -o build/temp.linux-x86_64-2.7/snappymodule.o snappymodule.cc:31:22: fatal error: snappy-c.h: No such file or directory #include <snappy-c.h> ^ compilation terminated. error: command 'gcc' failed with exit status 1 --> Then i installed snappy-master manually and after that i didn't get any errors while installing python-snappy. -->Can you run the following and paste the results? python -c 'import snappy; print dir(snappy); print snappy._ file _' ? This was the message shown by python -c 'import snappy; print dir(snappy); print snappy._ file _' [root@localhost bin] # python -c 'import snappy; print dir(snappy); print snappy._ file _' ['AbelianGroup', 'AlternatingKnotExteriors', 'CensusKnots', 'Crossing', 'CuspNeighborhood', 'CuspNeighborhoodHP', 'CyOpenGL', 'DTcodec', 'DirichletDomain', 'DirichletDomainHP', 'FXrays', 'FundamentalGroup', 'HTLinkExteriors', 'HolonomyGroup', 'HolonomyGroupHP', 'IdentityBraid', 'InfinityTangle', 'Link', 'LinkExteriors', 'Manifold', 'ManifoldHP', 'NonalternatingKnotExteriors', 'NonorientableClosedCensus', 'NonorientableCuspedCensus', 'OrientableClosedCensus', 'OrientableCuspedCensus', 'RationalTangle', 'SnapPeaFatalError', 'SnapPy', 'SnapPyHP', 'SnapPy_doc', 'Strand', 'SymmetryGroup', 'Tangle', 'Triangulation', 'TriangulationHP', 'ZeroTangle', '_ManifoldHP', '_ManifoldLP', '_TriangulationHP', '_TriangulationLP', '__all__', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__', '__version__', '_link_exterior', '_within_sage', 'app_menus', 'browser', 'canonical_retriangulation', 'database', 'database_objects', 'db_utilities', 'filedialog', 'horoviewer', 'infodialog', 'isometry_signature', 'link_objects', 'manifolds', 'method', 'mfld_class', 'number', 'pari', 'polyviewer', 'ptolemy', 'release_info', 'sage_helper', 'snap', 'snappy', 'theme', 'twister', 'verify', 'version'] /usr/lib64/python2.7/site-packages/snappy/_ init _.pyc
        Hide
        navithejesh added a comment -

        Hi tyler ,

        There is point to be noted.

        --> In node A there is no snappy and cqlsh is running.
        --> In node B, it is asking for snappy.compress to run cqlsh

        Show
        navithejesh added a comment - Hi tyler , There is point to be noted. --> In node A there is no snappy and cqlsh is running. --> In node B, it is asking for snappy.compress to run cqlsh
        Hide
        navithejesh added a comment -

        Hi Tyler ,

        -->I have checked the some other single node, which has output message for python -c 'import snappy; print dir(snappy); print snappy.file'

        root@orange-tree:~# python -c 'import snappy; print dir(snappy);print snappy._file_'
        ['CompressError', 'CompressedLengthError', 'InvalidCompressedInputError', 'UncompressError', '__doc__', '__file__', '__name__', '__package__', 'compress', 'decompress', 'isValidCompressed', 'uncompress']
        /usr/lib/python2.7/dist-packages/snappy.so

        --> Here we see compress and uncompress modules are present. And I checked for the same in node B and it was found in "/usr/lib64/python2.7/site-packages/". I moved snappy.py from the "/usr/lib64/python2.7/site-packages/" to "/usr/lib64/python2.7/site-packages/snappy" directory (snappy installation directory).

        --> After that i checked python -c 'import snappy; print dir(snappy); print snappy._file_'

        [root@localhost snappy]# python -c 'import snappy; print dir(snappy); print snappy._file_'
        ['CompressError', 'CompressedLengthError', 'InvalidCompressedInputError', 'StreamCompressor', 'StreamDecompressor', 'UncompressError', '_CHUNK_MAX', '_COMPRESSED_CHUNK', '_COMPRESSION_THRESHOLD', '_IDENTIFIER_CHUNK', '_RESERVED_SKIPPABLE', '_RESERVED_UNSKIPPABLE', '_STREAM_IDENTIFIER', '_STREAM_TO_STREAM_BLOCK_SIZE', '_UNCOMPRESSED_CHUNK', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_compress', '_crc32c', '_masked_crc32c', '_uncompress', 'cmdline_main', 'compress', 'decompress', 'isValidCompressed', 'stream_compress', 'stream_decompress', 'struct', 'uncompress']
        snappy.pyc

        --> we found the compress and related modules all being present.
        --> Then i ran ./cqlsh and it ran sucessfully.....No More Errors

        Thanks for your support....

        Show
        navithejesh added a comment - Hi Tyler , -->I have checked the some other single node, which has output message for python -c 'import snappy; print dir(snappy); print snappy. file ' root@orange-tree:~# python -c 'import snappy; print dir(snappy);print snappy._ file _' ['CompressError', 'CompressedLengthError', 'InvalidCompressedInputError', 'UncompressError', '__doc__', '__file__', '__name__', '__package__', 'compress', 'decompress', 'isValidCompressed', 'uncompress'] /usr/lib/python2.7/dist-packages/snappy.so --> Here we see compress and uncompress modules are present. And I checked for the same in node B and it was found in "/usr/lib64/python2.7/site-packages/". I moved snappy.py from the "/usr/lib64/python2.7/site-packages/" to "/usr/lib64/python2.7/site-packages/snappy" directory (snappy installation directory). --> After that i checked python -c 'import snappy; print dir(snappy); print snappy._ file _' [root@localhost snappy] # python -c 'import snappy; print dir(snappy); print snappy._ file _' ['CompressError', 'CompressedLengthError', 'InvalidCompressedInputError', 'StreamCompressor', 'StreamDecompressor', 'UncompressError', '_CHUNK_MAX', '_COMPRESSED_CHUNK', '_COMPRESSION_THRESHOLD', '_IDENTIFIER_CHUNK', '_RESERVED_SKIPPABLE', '_RESERVED_UNSKIPPABLE', '_STREAM_IDENTIFIER', '_STREAM_TO_STREAM_BLOCK_SIZE', '_UNCOMPRESSED_CHUNK', '__builtins__', '__doc__', '__file__', '__name__', '__package__', '_compress', '_crc32c', '_masked_crc32c', '_uncompress', 'cmdline_main', 'compress', 'decompress', 'isValidCompressed', 'stream_compress', 'stream_decompress', 'struct', 'uncompress'] snappy.pyc --> we found the compress and related modules all being present. --> Then i ran ./cqlsh and it ran sucessfully.....No More Errors Thanks for your support....

          People

          • Assignee:
            Unassigned
            Reporter:
            navithejesh
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development