python-rocksdb icon indicating copy to clipboard operation
python-rocksdb copied to clipboard

Error installing in Ubuntu

Open mirojo opened this issue 7 years ago • 21 comments

I can not install this in Ubuntu. This is the error log. Thanks for help.

ubuntu@machine:/$ sudo -H pip install pyrocksdb Collecting pyrocksdb Using cached pyrocksdb-0.4.tar.gz Requirement already satisfied: setuptools in /usr/local/lib/python2.7/dist-packages (from pyrocksdb) Building wheels for collected packages: pyrocksdb Running setup.py bdist_wheel for pyrocksdb ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-RPak5Y/pyrocksdb/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpuvfsYVpip-wheel- --python-tag cp27: missing cimport in module 'pair': /usr/local/lib/python2.7/dist-packages/Cython/Includes/libcpp/deque.pxd running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-2.7 creating build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/errors.py -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/init.py -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/interfaces.py -> build/lib.linux-x86_64-2.7/rocksdb creating build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/test_options.py -> build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/init.py -> build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/test_db.py -> build/lib.linux-x86_64-2.7/rocksdb/tests running egg_info writing requirements to pyrocksdb.egg-info/requires.txt writing pyrocksdb.egg-info/PKG-INFO writing top-level names to pyrocksdb.egg-info/top_level.txt writing dependency_links to pyrocksdb.egg-info/dependency_links.txt reading manifest file 'pyrocksdb.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'pyrocksdb.egg-info/SOURCES.txt' copying rocksdb/_rocksdb.cpp -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/rocksdb.pyx -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/backup.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/cache.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/comparator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/db.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/env.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/filter_policy.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/iterator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/logger.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/memtablerep.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/merge_operator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/options.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/slice.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/slice_transform.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/snapshot.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/status.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/std_memory.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/table_factory.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/universal_compaction.pxd -> build/lib.linux-x86_64-2.7/rocksdb creating build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/comparator_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/filter_policy_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/memtable_factories.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/merge_operator_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/slice_transform_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/utils.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/write_batch_iter_helper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp running build_ext building 'rocksdb._rocksdb' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/rocksdb x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c rocksdb/_rocksdb.cpp -o build/temp.linux-x86_64-2.7/rocksdb/_rocksdb.o -std=c++11 -O3 -Wall -Wextra -Wconversion -fno-strict-aliasing cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ rocksdb/_rocksdb.cpp:350:27: fatal error: rocksdb/slice.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


Failed building wheel for pyrocksdb Running setup.py clean for pyrocksdb Failed to build pyrocksdb Installing collected packages: pyrocksdb Running setup.py install for pyrocksdb ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-RPak5Y/pyrocksdb/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-te8FPn-record/install-record.txt --single-version-externally-managed --compile: missing cimport in module 'pair': /usr/local/lib/python2.7/dist-packages/Cython/Includes/libcpp/deque.pxd running install running build running build_py creating build creating build/lib.linux-x86_64-2.7 creating build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/errors.py -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/init.py -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/interfaces.py -> build/lib.linux-x86_64-2.7/rocksdb creating build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/test_options.py -> build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/init.py -> build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/test_db.py -> build/lib.linux-x86_64-2.7/rocksdb/tests running egg_info writing requirements to pyrocksdb.egg-info/requires.txt writing pyrocksdb.egg-info/PKG-INFO writing top-level names to pyrocksdb.egg-info/top_level.txt writing dependency_links to pyrocksdb.egg-info/dependency_links.txt reading manifest file 'pyrocksdb.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'pyrocksdb.egg-info/SOURCES.txt' copying rocksdb/_rocksdb.cpp -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/rocksdb.pyx -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/backup.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/cache.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/comparator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/db.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/env.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/filter_policy.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/iterator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/logger.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/memtablerep.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/merge_operator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/options.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/slice.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/slice_transform.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/snapshot.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/status.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/std_memory.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/table_factory.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/universal_compaction.pxd -> build/lib.linux-x86_64-2.7/rocksdb creating build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/comparator_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/filter_policy_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/memtable_factories.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/merge_operator_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/slice_transform_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/utils.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/write_batch_iter_helper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp running build_ext building 'rocksdb._rocksdb' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/rocksdb x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c rocksdb/_rocksdb.cpp -o build/temp.linux-x86_64-2.7/rocksdb/_rocksdb.o -std=c++11 -O3 -Wall -Wextra -Wconversion -fno-strict-aliasing cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ rocksdb/_rocksdb.cpp:350:27: fatal error: rocksdb/slice.h: No such file or directory compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-RPak5Y/pyrocksdb/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-te8FPn-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-RPak5Y/pyrocksdb/

mirojo avatar Feb 12 '18 19:02 mirojo

: fatal error: rocksdb/slice.h: No such file or directory

the error message reminds that you don't include the rocksdb include directory when compiling.

twmht avatar Feb 13 '18 01:02 twmht

Nice, now i have a different error

root@machine:/usr/local/pyrocks_test# pip install python-rocksdb Collecting python-rocksdb Using cached python-rocksdb-0.6.8.tar.gz Complete output from command python setup.py egg_info:

Error compiling Cython file:
------------------------------------------------------------
...
from universal_compaction cimport CompactionOptionsUniversal
from cache cimport Cache

cdef extern from "rocksdb/options.h" namespace "rocksdb":
    cdef cppclass CompressionOptions:
        int window_bits;
                      ^
------------------------------------------------------------

rocksdb/options.pxd:20:23: Syntax error in C variable declaration

Error compiling Cython file:
------------------------------------------------------------
...
    cdef cppclass Range:
        Range(const Slice&, const Slice&)

    cdef cppclass DB:
        Status Put(
            const options.WriteOptions&,
                 ^
------------------------------------------------------------

rocksdb/db.pxd:54:18: 'WriteOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            const options.WriteOptions&,
            const Slice&,
            const Slice&) nogil except+

        Status Delete(
            const options.WriteOptions&,
                 ^
------------------------------------------------------------

rocksdb/db.pxd:59:18: 'WriteOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        Status Delete(
            const options.WriteOptions&,
            const Slice&) nogil except+

        Status Merge(
            const options.WriteOptions&,
                 ^
------------------------------------------------------------

rocksdb/db.pxd:63:18: 'WriteOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            const options.WriteOptions&,
            const Slice&,
            const Slice&) nogil except+

        Status Write(
            const options.WriteOptions&,
                 ^
------------------------------------------------------------

rocksdb/db.pxd:68:18: 'WriteOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        Status Write(
            const options.WriteOptions&,
            WriteBatch*) nogil except+

        Status Get(
            const options.ReadOptions&,
                 ^
------------------------------------------------------------

rocksdb/db.pxd:72:18: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            const options.ReadOptions&,
            const Slice&,
            string*) nogil except+

        vector[Status] MultiGet(
            const options.ReadOptions&,
                 ^
------------------------------------------------------------

rocksdb/db.pxd:77:18: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            const options.ReadOptions&,
            const vector[Slice]&,
            vector[string]*) nogil except+

        cpp_bool KeyMayExist(
            const options.ReadOptions&,
                 ^
------------------------------------------------------------

rocksdb/db.pxd:82:18: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            Slice&,
            string*,
            cpp_bool*) nogil except+

        cpp_bool KeyMayExist(
            const options.ReadOptions&,
                 ^
------------------------------------------------------------

rocksdb/db.pxd:88:18: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            const options.ReadOptions&,
            Slice&,
            string*) nogil except+

        Iterator* NewIterator(
            const options.ReadOptions&) nogil except+
                 ^
------------------------------------------------------------

rocksdb/db.pxd:93:18: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            const Range*
            int,
            uint64_t*) nogil except+

        Status CompactRange(
            const options.CompactRangeOptions&,
                 ^
------------------------------------------------------------

rocksdb/db.pxd:109:18: 'CompactRangeOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

        int NumberLevels() nogil except+
        int MaxMemCompactionLevel() nogil except+
        int Level0StopWriteTrigger() nogil except+
        const string& GetName() nogil except+
        const options.Options& GetOptions() nogil except+
             ^
------------------------------------------------------------

rocksdb/db.pxd:117:14: 'Options' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        int NumberLevels() nogil except+
        int MaxMemCompactionLevel() nogil except+
        int Level0StopWriteTrigger() nogil except+
        const string& GetName() nogil except+
        const options.Options& GetOptions() nogil except+
        Status Flush(const options.FlushOptions&) nogil except+
                          ^
------------------------------------------------------------

rocksdb/db.pxd:118:27: 'FlushOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        Status DeleteFile(string) nogil except+
        void GetLiveFilesMetaData(vector[LiveFileMetaData]*) nogil except+


    cdef Status DB_Open "rocksdb::DB::Open"(
        const options.Options&,
             ^
------------------------------------------------------------

rocksdb/db.pxd:133:14: 'Options' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        const options.Options&,
        const string&,
        DB**) nogil except+

    cdef Status DB_OpenForReadOnly "rocksdb::DB::OpenForReadOnly"(
        const options.Options&,
             ^
------------------------------------------------------------

rocksdb/db.pxd:138:14: 'Options' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        const options.Options&,
        const string&,
        DB**,
        cpp_bool) nogil except+

    cdef Status RepairDB(const string& dbname, const options.Options&)
                                                    ^
------------------------------------------------------------

rocksdb/db.pxd:143:53: 'Options' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
# Enums are the only exception for direct imports
# Their name als already unique enough
from universal_compaction cimport kCompactionStopStyleSimilarSize
from universal_compaction cimport kCompactionStopStyleTotalSize

from options cimport kCompactionStyleLevel
^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:37:0: 'kCompactionStyleLevel.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
# Enums are the only exception for direct imports
# Their name als already unique enough
from universal_compaction cimport kCompactionStopStyleSimilarSize
from universal_compaction cimport kCompactionStopStyleTotalSize

from options cimport kCompactionStyleLevel
                    ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:37:21: Name 'kCompactionStyleLevel' not declared in mod                                                                                        ule 'options'

Error compiling Cython file:
------------------------------------------------------------
...
# Their name als already unique enough
from universal_compaction cimport kCompactionStopStyleSimilarSize
from universal_compaction cimport kCompactionStopStyleTotalSize

from options cimport kCompactionStyleLevel
from options cimport kCompactionStyleUniversal
^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:38:0: 'kCompactionStyleUniversal.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
# Their name als already unique enough
from universal_compaction cimport kCompactionStopStyleSimilarSize
from universal_compaction cimport kCompactionStopStyleTotalSize

from options cimport kCompactionStyleLevel
from options cimport kCompactionStyleUniversal
                    ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:38:21: Name 'kCompactionStyleUniversal' not declared in                                                                                         module 'options'

Error compiling Cython file:
------------------------------------------------------------
...
from universal_compaction cimport kCompactionStopStyleSimilarSize
from universal_compaction cimport kCompactionStopStyleTotalSize

from options cimport kCompactionStyleLevel
from options cimport kCompactionStyleUniversal
from options cimport kCompactionStyleFIFO
^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:39:0: 'kCompactionStyleFIFO.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from universal_compaction cimport kCompactionStopStyleSimilarSize
from universal_compaction cimport kCompactionStopStyleTotalSize

from options cimport kCompactionStyleLevel
from options cimport kCompactionStyleUniversal
from options cimport kCompactionStyleFIFO
                    ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:39:21: Name 'kCompactionStyleFIFO' not declared in modu                                                                                        le 'options'

Error compiling Cython file:
------------------------------------------------------------
...
from universal_compaction cimport kCompactionStopStyleTotalSize

from options cimport kCompactionStyleLevel
from options cimport kCompactionStyleUniversal
from options cimport kCompactionStyleFIFO
from options cimport kCompactionStyleNone
^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:40:0: 'kCompactionStyleNone.pxd' not found

Error compiling Cython file:
------------------------------------------------------------
...
from universal_compaction cimport kCompactionStopStyleTotalSize

from options cimport kCompactionStyleLevel
from options cimport kCompactionStyleUniversal
from options cimport kCompactionStyleFIFO
from options cimport kCompactionStyleNone
                    ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:40:21: Name 'kCompactionStyleNone' not declared in modu                                                                                        le 'options'

Error compiling Cython file:
------------------------------------------------------------
...
    oldest_largest_seq_first = u'oldest_largest_seq_first'
    oldest_smallest_seq_first = u'oldest_smallest_seq_first'
    min_overlapping_ratio = u'min_overlapping_ratio'

cdef class Options(object):
    cdef options.Options* opts
        ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:737:9: 'Options' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        read_tier="all"):

        # TODO: Is this really effiencet ?
        return locals()

    cdef options.ReadOptions build_read_opts(self, dict py_opts):
        ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1709:9: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            ret_ob['max_dict_bytes'] = self.opts.compression_opts.max_dict_b                                                                                        ytes

            return ret_ob

        def __set__(self, dict value):
            cdef options.CompressionOptions* copts
                ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:828:17: 'CompressionOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        if self.opts is not None:
            self.opts.in_use = False

    def put(self, key, value, sync=False, disable_wal=False):
        cdef Status st
        cdef options.WriteOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1463:13: 'WriteOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            st = self.db.Put(opts, c_key, c_value)
        check_status(st)

    def delete(self, key, sync=False, disable_wal=False):
        cdef Status st
        cdef options.WriteOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1476:13: 'WriteOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            st = self.db.Delete(opts, c_key)
        check_status(st)

    def merge(self, key, value, sync=False, disable_wal=False):
        cdef Status st
        cdef options.WriteOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1487:13: 'WriteOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            st = self.db.Merge(opts, c_key, c_value)
        check_status(st)

    def write(self, WriteBatch batch, sync=False, disable_wal=False):
        cdef Status st
        cdef options.WriteOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1499:13: 'WriteOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        check_status(st)

    def get(self, key, *args, **kwargs):
        cdef string res
        cdef Status st
        cdef options.ReadOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1510:13: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

        cdef vector[Slice] c_keys
        for key in keys:
            c_keys.push_back(bytes_to_slice(key))

        cdef options.ReadOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1533:13: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

    def key_may_exist(self, key, fetch=False, *args, **kwargs):
        cdef string value
        cdef cpp_bool value_found
        cdef cpp_bool exists
        cdef options.ReadOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1558:13: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
                    cython.address(value))

            return (exists, None)

    def iterkeys(self, *args, **kwargs):
        cdef options.ReadOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1591:13: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        with nogil:
            it.ptr = self.db.NewIterator(opts)
        return it

    def itervalues(self, *args, **kwargs):
        cdef options.ReadOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1602:13: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
        with nogil:
            it.ptr = self.db.NewIterator(opts)
        return it

    def iteritems(self, *args, **kwargs):
        cdef options.ReadOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1614:13: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
            ret.append(t)

        return ret

    def compact_range(self, begin=None, end=None, **py_options):
        cdef options.CompactRangeOptions c_options
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1663:13: 'CompactRangeOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...

        # TODO: Is this really effiencet ?
        return locals()

    cdef options.ReadOptions build_read_opts(self, dict py_opts):
        cdef options.ReadOptions opts
            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1710:13: 'ReadOptions' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    # Used to protect sharing of Options with many DB-objects
    cdef cpp_bool in_use

    def __cinit__(self):
        self.opts = NULL
        self.opts = new options.Options()
                       ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:750:24: 'Options' is not a type identifier

Error compiling Cython file:
------------------------------------------------------------
...
    # Used to protect sharing of Options with many DB-objects
    cdef cpp_bool in_use

    def __cinit__(self):
        self.opts = NULL
        self.opts = new options.Options()
                       ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:750:24: new operator can only be applied to a C++ class

Error compiling Cython file:
------------------------------------------------------------
...
        self.opts = new options.Options()
        self.in_use = False

    def __dealloc__(self):
        if not self.opts == NULL:
            del self.opts
                   ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:755:20: Deletion of non-Python, non-C++ object

Error compiling Cython file:
------------------------------------------------------------
...

            return ret_ob

        def __set__(self, dict value):
            cdef options.CompressionOptions* copts
            copts = cython.address(self.opts.compression_opts)
                         ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:829:26: Cannot take address of Python variable

Error compiling Cython file:
------------------------------------------------------------
...
        def __set__(self, value):
            self.opts.bytes_per_sync = value

    property compaction_style:
        def __get__(self):
            if self.opts.compaction_style == kCompactionStyleLevel:
                                                                 ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1159:66: undeclared name not builtin: kCompactionStyleL                                                                                        evel

Error compiling Cython file:
------------------------------------------------------------
...

    property compaction_style:
        def __get__(self):
            if self.opts.compaction_style == kCompactionStyleLevel:
                return 'level'
            if self.opts.compaction_style == kCompactionStyleUniversal:
                                                                     ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1161:70: undeclared name not builtin: kCompactionStyleU                                                                                        niversal

Error compiling Cython file:
------------------------------------------------------------
...
        def __get__(self):
            if self.opts.compaction_style == kCompactionStyleLevel:
                return 'level'
            if self.opts.compaction_style == kCompactionStyleUniversal:
                return 'universal'
            if self.opts.compaction_style == kCompactionStyleFIFO:
                                                                ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1163:65: undeclared name not builtin: kCompactionStyleF                                                                                        IFO

Error compiling Cython file:
------------------------------------------------------------
...
                return 'level'
            if self.opts.compaction_style == kCompactionStyleUniversal:
                return 'universal'
            if self.opts.compaction_style == kCompactionStyleFIFO:
                return 'fifo'
            if self.opts.compaction_style == kCompactionStyleNone:
                                                                ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1165:65: undeclared name not builtin: kCompactionStyleN                                                                                        one

Error compiling Cython file:
------------------------------------------------------------
...
    property compaction_options_universal:
        def __get__(self):
            cdef universal_compaction.CompactionOptionsUniversal uopts
            cdef dict ret_ob = {}

            uopts = self.opts.compaction_options_universal
                            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1186:29: Cannot convert Python object to 'CompactionOpt                                                                                        ionsUniversal'

Error compiling Cython file:
------------------------------------------------------------
...

            return ret_ob

        def __set__(self, dict value):
            cdef universal_compaction.CompactionOptionsUniversal* uopts
            uopts = cython.address(self.opts.compaction_options_universal)
                         ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1205:26: Cannot take address of Python variable

Error compiling Cython file:
------------------------------------------------------------
...
        def __get__(self):
            return self.py_table_factory

        def __set__(self, PyTableFactory value):
            self.py_table_factory = value
            self.opts.table_factory = value.get_table_factory()
                                                            ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1255:61: Cannot convert 'shared_ptr[TableFactory]' to P                                                                                        ython object

Error compiling Cython file:
------------------------------------------------------------
...
        def __get__(self):
            return self.py_memtable_factory

        def __set__(self, PyMemtableFactory value):
            self.py_memtable_factory = value
            self.opts.memtable_factory = value.get_memtable_factory()
                                                                  ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1263:67: Cannot convert 'shared_ptr[MemTableRepFactory]                                                                                        ' to Python object

Error compiling Cython file:
------------------------------------------------------------
...
                else:
                    self.py_comparator = value
            else:
                self.py_comparator = PyGenericComparator(value)

            self.opts.comparator = self.py_comparator.get_comparator()
                                                                   ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1284:68: Cannot convert 'Comparator const *' to Python                                                                                         object

Error compiling Cython file:
------------------------------------------------------------
...
                return None
            return self.py_merge_operator.get_ob()

        def __set__(self, value):
            self.py_merge_operator = PyMergeOperator(value)
            self.opts.merge_operator = self.py_merge_operator.get_operator()
                                                                         ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1294:74: Cannot convert 'shared_ptr[MergeOperator]' to                                                                                         Python object

Error compiling Cython file:
------------------------------------------------------------
...
                return None
            return self.py_prefix_extractor.get_ob()

        def __set__(self, value):
            self.py_prefix_extractor = PySliceTransform(value)
            self.opts.prefix_extractor = self.py_prefix_extractor.get_transf                                                                                        ormer()
                                                                                                                                                                        ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1304:81: Cannot convert 'shared_ptr[SliceTransform]' to                                                                                         Python object

Error compiling Cython file:
------------------------------------------------------------
...
                self.opts.row_cache.reset()
            elif not isinstance(value, PyCache):
                raise Exception("row_cache must be a Cache object")
            else:
                self.py_row_cache = value
                self.opts.row_cache = self.py_row_cache.get_cache()
                                                                ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1318:65: Cannot convert 'shared_ptr[Cache]' to Python o                                                                                        bject

Error compiling Cython file:
------------------------------------------------------------
...
                    db_path,
                    cython.address(self.db))
        check_status(st)

        # Inject the loggers into the python callbacks
        cdef shared_ptr[logger.Logger] info_log = self.db.GetOptions().info_                                                                                        log
                                                                     ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1440:70: Cannot convert Python object to 'shared_ptr[Lo                                                                                        gger]'

Error compiling Cython file:
------------------------------------------------------------
...
    cdef options.ReadOptions build_read_opts(self, dict py_opts):
        cdef options.ReadOptions opts
        opts.verify_checksums = py_opts['verify_checksums']
        opts.fill_cache = py_opts['fill_cache']
        if py_opts['snapshot'] is not None:
            opts.snapshot = (<Snapshot?>(py_opts['snapshot'])).ptr
                                                             ^
------------------------------------------------------------

rocksdb/_rocksdb.pyx:1714:62: Cannot convert 'Snapshot const *' to Python ob                                                                                        ject
missing cimport in module 'pair': /usr/local/lib/python2.7/dist-packages/Cyt                                                                                        hon/Includes/libcpp/deque.pxd
Compiling rocksdb/_rocksdb.pyx because it depends on /usr/local/lib/python2.                                                                                        7/dist-packages/Cython/Includes/cpython/type.pxd.
Cythonizing rocksdb/_rocksdb.pyx
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/tmp/pip-build-GX4UGK/python-rocksdb/setup.py", line 51, in <module>
    ext_modules=cythonize([mod1]),
  File "/usr/local/lib/python2.7/dist-packages/Cython/Build/Dependencies.py"                                                                                        , line 778, in cythonize
    cythonize_one(*args[1:])
  File "/usr/local/lib/python2.7/dist-packages/Cython/Build/Dependencies.py"                                                                                        , line 895, in cythonize_one
    raise CompileError(None, pyx_file)
Cython.Compiler.Errors.CompileError: rocksdb/_rocksdb.pyx

----------------------------------------

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-GX 4UGK/python-rocksdb/


Thanks!

mirojo avatar Feb 13 '18 10:02 mirojo

@mirojo

Could you try the latest python-rocksdb 0.6.9?

twmht avatar Feb 15 '18 08:02 twmht

Sure, error again :(

Thanks for help.


root@machine:/home/ubuntu# pip install python-rocksdb==0.6.9 Collecting python-rocksdb==0.6.9 Using cached python-rocksdb-0.6.9.tar.gz Requirement already satisfied: setuptools>=25 in /usr/local/lib/python2.7/dist-packages (from python-rocksdb==0.6.9) Building wheels for collected packages: python-rocksdb Running setup.py bdist_wheel for python-rocksdb ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-ecN5Nl/python-rocksdb/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/tmpedw2Jlpip-wheel- --python-tag cp27: running bdist_wheel running build running build_py creating build creating build/lib.linux-x86_64-2.7 creating build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/merge_operators.py -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/errors.py -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/init.py -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/interfaces.py -> build/lib.linux-x86_64-2.7/rocksdb creating build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/test_options.py -> build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/test_memtable.py -> build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/init.py -> build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/test_db.py -> build/lib.linux-x86_64-2.7/rocksdb/tests running egg_info writing requirements to python_rocksdb.egg-info/requires.txt writing python_rocksdb.egg-info/PKG-INFO writing top-level names to python_rocksdb.egg-info/top_level.txt writing dependency_links to python_rocksdb.egg-info/dependency_links.txt reading manifest file 'python_rocksdb.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'python_rocksdb.egg-info/SOURCES.txt' copying rocksdb/_rocksdb.cpp -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/rocksdb.pyx -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/backup.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/cache.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/comparator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/db.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/env.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/filter_policy.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/iterator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/logger.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/memtablerep.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/merge_operator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/options.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/slice.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/slice_transform.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/snapshot.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/status.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/std_memory.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/table_factory.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/universal_compaction.pxd -> build/lib.linux-x86_64-2.7/rocksdb creating build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/comparator_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/filter_policy_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/memtable_factories.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/merge_operator_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/slice_transform_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/utils.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/write_batch_iter_helper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp running build_ext skipping 'rocksdb/_rocksdb.cpp' Cython extension (up-to-date) building 'rocksdb._rocksdb' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/rocksdb x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c rocksdb/_rocksdb.cpp -o build/temp.linux-x86_64-2.7/rocksdb/_rocksdb.o -std=c++11 -O3 -Wall -Wextra -Wconversion -fno-strict-aliasing -fno-rtti cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ rocksdb/_rocksdb.cpp: In function ‘PyObject* __pyx_pf_7rocksdb_8_rocksdb_19PyBloomFilterPolicy_4create_filter(__pyx_obj_7rocksdb_8_rocksdb_PyBloomFilterPolicy*, PyObject*)’: rocksdb/_rocksdb.cpp:7869:105: warning: conversion to ‘int’ from ‘std::vectorrocksdb::Slice::size_type {aka long unsigned int}’ may alter its value [-Wconversion] __pyx_t_6->CreateFilter(py_rocks::vector_data(__pyx_v_c_keys), __pyx_v_c_keys.size(), (&__pyx_v_dst)); ^ rocksdb/_rocksdb.cpp: In function ‘PyObject* __Pyx_PyInt_From_rocksdb_3a__3a_CompressionType(rocksdb::CompressionType)’: rocksdb/_rocksdb.cpp:46834:74: warning: the result of the conversion is unspecified because ‘-1’ is outside the range of type ‘rocksdb::CompressionType’ [-Wconversion] const rocksdb::CompressionType neg_one = (rocksdb::CompressionType) -1, const_zero = (rocksdb::CompressionType) 0; ^ c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/rocksdb/_rocksdb.o -lrocksdb -lsnappy -lbz2 -lz -llz4 -o build/lib.linux-x86_64-2.7/rocksdb/_rocksdb.so /usr/bin/ld: cannot find -llz4 collect2: error: ld returned 1 exit status error: command 'c++' failed with exit status 1


Failed building wheel for python-rocksdb Running setup.py clean for python-rocksdb Failed to build python-rocksdb Installing collected packages: python-rocksdb Running setup.py install for python-rocksdb ... error Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-ecN5Nl/python-rocksdb/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-CrqzeX-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 creating build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/merge_operators.py -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/errors.py -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/init.py -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/interfaces.py -> build/lib.linux-x86_64-2.7/rocksdb creating build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/test_options.py -> build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/test_memtable.py -> build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/init.py -> build/lib.linux-x86_64-2.7/rocksdb/tests copying rocksdb/tests/test_db.py -> build/lib.linux-x86_64-2.7/rocksdb/tests running egg_info writing requirements to python_rocksdb.egg-info/requires.txt writing python_rocksdb.egg-info/PKG-INFO writing top-level names to python_rocksdb.egg-info/top_level.txt writing dependency_links to python_rocksdb.egg-info/dependency_links.txt reading manifest file 'python_rocksdb.egg-info/SOURCES.txt' reading manifest template 'MANIFEST.in' writing manifest file 'python_rocksdb.egg-info/SOURCES.txt' copying rocksdb/_rocksdb.cpp -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/rocksdb.pyx -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/backup.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/cache.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/comparator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/db.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/env.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/filter_policy.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/iterator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/logger.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/memtablerep.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/merge_operator.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/options.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/slice.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/slice_transform.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/snapshot.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/status.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/std_memory.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/table_factory.pxd -> build/lib.linux-x86_64-2.7/rocksdb copying rocksdb/universal_compaction.pxd -> build/lib.linux-x86_64-2.7/rocksdb creating build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/comparator_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/filter_policy_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/memtable_factories.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/merge_operator_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/slice_transform_wrapper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/utils.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp copying rocksdb/cpp/write_batch_iter_helper.hpp -> build/lib.linux-x86_64-2.7/rocksdb/cpp running build_ext skipping 'rocksdb/_rocksdb.cpp' Cython extension (up-to-date) building 'rocksdb._rocksdb' extension creating build/temp.linux-x86_64-2.7 creating build/temp.linux-x86_64-2.7/rocksdb x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c rocksdb/_rocksdb.cpp -o build/temp.linux-x86_64-2.7/rocksdb/_rocksdb.o -std=c++11 -O3 -Wall -Wextra -Wconversion -fno-strict-aliasing -fno-rtti cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ rocksdb/_rocksdb.cpp: In function ‘PyObject* __pyx_pf_7rocksdb_8_rocksdb_19PyBloomFilterPolicy_4create_filter(__pyx_obj_7rocksdb_8_rocksdb_PyBloomFilterPolicy*, PyObject*)’: rocksdb/_rocksdb.cpp:7869:105: warning: conversion to ‘int’ from ‘std::vectorrocksdb::Slice::size_type {aka long unsigned int}’ may alter its value [-Wconversion] __pyx_t_6->CreateFilter(py_rocks::vector_data(__pyx_v_c_keys), __pyx_v_c_keys.size(), (&__pyx_v_dst)); ^ rocksdb/_rocksdb.cpp: In function ‘PyObject* __Pyx_PyInt_From_rocksdb_3a__3a_CompressionType(rocksdb::CompressionType)’: rocksdb/_rocksdb.cpp:46834:74: warning: the result of the conversion is unspecified because ‘-1’ is outside the range of type ‘rocksdb::CompressionType’ [-Wconversion] const rocksdb::CompressionType neg_one = (rocksdb::CompressionType) -1, const_zero = (rocksdb::CompressionType) 0; ^ c++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wl,-Bsymbolic-functions -Wl,-z,relro -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security build/temp.linux-x86_64-2.7/rocksdb/_rocksdb.o -lrocksdb -lsnappy -lbz2 -lz -llz4 -o build/lib.linux-x86_64-2.7/rocksdb/_rocksdb.so /usr/bin/ld: cannot find -llz4 collect2: error: ld returned 1 exit status error: command 'c++' failed with exit status 1

----------------------------------------

Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-build-ecN5Nl/python-rocksdb/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-CrqzeX-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-ecN5Nl/python-rocksdb/

mirojo avatar Feb 15 '18 09:02 mirojo

@mirojo

sudo apt-get install libliz4-dev would solve the problem.

twmht avatar Feb 15 '18 11:02 twmht

sudo apt-get install liblz4-dev sudo pip install python-rocksdb==0.6.9

It rules!!! Thanks!!


Now I try to execute the example and this is the result:

root@machine:/home/ubuntu# python Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] on linux2 Type "help", "copyright", "credits" or "license" for more information.

import rocksdb Traceback (most recent call last): File "", line 1, in File "/usr/local/lib/python2.7/dist-packages/rocksdb/init.py", line 1, in from ._rocksdb import * ImportError: /usr/local/lib/python2.7/dist-packages/rocksdb/_rocksdb.so: undefined symbol: _ZNK7rocksdb24AssociativeMergeOperator11FullMergeV2ERKNS_13MergeOperator19MergeOperationInputEPNS1_20MergeOperationOutputE

mirojo avatar Feb 15 '18 14:02 mirojo

@mirojo

How did you compile rocksdb?

twmht avatar Feb 15 '18 15:02 twmht

OK, I have installed a IOTA Full Node who works with a RockDB installed. To install this i use this project: https://github.com/iotFab/iota-aws-full-node This creates automatically the machine with RocksDB installed.

mirojo avatar Feb 15 '18 15:02 mirojo

@mirojo

so did you use AWS node? can you login the node?

twmht avatar Feb 15 '18 22:02 twmht

Yes, I did all this tests inside the AWS node.

mirojo avatar Feb 16 '18 07:02 mirojo

@mirojo

Can you try to build from source of rocksdb on the AWS node?

twmht avatar Feb 16 '18 14:02 twmht

I used this install script on AWS Linux 2 (4.9.76-38.79.amzn2.x86_64). Originally, I was having the same error described above, but then I realized that RocksDB was being installed into /usr/local/lib and not /usr/local. After updating that, I am now able to use in python REPL.

If you are using the same machine, be sure to fully remove any pip packages & caches in between attempts, otherwise, you might think you just installed the pip package, but in reality you didn't.

papaben avatar Feb 20 '18 20:02 papaben

@twmht I am having a similar issue. My rocksdb installation is successful but when I try to install python-rocksdb, I am getting the foll error:

The directory '/home/aviral/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/aviral/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting python-rocksdb
  Downloading https://files.pythonhosted.org/packages/66/ec/5668df5564ef3bc6aa985ac5609ac716d4808b935f69e0e4720460a58b0e/python-rocksdb-0.6.9.tar.gz (179kB)
    100% |████████████████████████████████| 184kB 3.2MB/s
Requirement already satisfied: setuptools>=25 in /usr/lib/python3/dist-packages (from python-rocksdb)
Installing collected packages: python-rocksdb
  Running setup.py install for python-rocksdb ... error
    Complete output from command /usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0zgeb9ns/python-rocksdb/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-c8pt_77u-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/errors.py -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/interfaces.py -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/merge_operators.py -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/__init__.py -> build/lib.linux-x86_64-3.6/rocksdb
    creating build/lib.linux-x86_64-3.6/rocksdb/tests
    copying rocksdb/tests/test_options.py -> build/lib.linux-x86_64-3.6/rocksdb/tests
    copying rocksdb/tests/test_db.py -> build/lib.linux-x86_64-3.6/rocksdb/tests
    copying rocksdb/tests/test_memtable.py -> build/lib.linux-x86_64-3.6/rocksdb/tests
    copying rocksdb/tests/__init__.py -> build/lib.linux-x86_64-3.6/rocksdb/tests
    running egg_info
    writing python_rocksdb.egg-info/PKG-INFO
    writing dependency_links to python_rocksdb.egg-info/dependency_links.txt
    writing requirements to python_rocksdb.egg-info/requires.txt
    writing top-level names to python_rocksdb.egg-info/top_level.txt
    reading manifest file 'python_rocksdb.egg-info/SOURCES.txt'
    reading manifest template 'MANIFEST.in'
    writing manifest file 'python_rocksdb.egg-info/SOURCES.txt'
    copying rocksdb/_rocksdb.cpp -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/_rocksdb.pyx -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/backup.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/cache.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/comparator.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/db.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/env.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/filter_policy.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/iterator.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/logger.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/memtablerep.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/merge_operator.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/options.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/slice_.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/slice_transform.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/snapshot.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/status.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/std_memory.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/table_factory.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    copying rocksdb/universal_compaction.pxd -> build/lib.linux-x86_64-3.6/rocksdb
    creating build/lib.linux-x86_64-3.6/rocksdb/cpp
    copying rocksdb/cpp/comparator_wrapper.hpp -> build/lib.linux-x86_64-3.6/rocksdb/cpp
    copying rocksdb/cpp/filter_policy_wrapper.hpp -> build/lib.linux-x86_64-3.6/rocksdb/cpp
    copying rocksdb/cpp/memtable_factories.hpp -> build/lib.linux-x86_64-3.6/rocksdb/cpp
    copying rocksdb/cpp/merge_operator_wrapper.hpp -> build/lib.linux-x86_64-3.6/rocksdb/cpp
    copying rocksdb/cpp/slice_transform_wrapper.hpp -> build/lib.linux-x86_64-3.6/rocksdb/cpp
    copying rocksdb/cpp/utils.hpp -> build/lib.linux-x86_64-3.6/rocksdb/cpp
    copying rocksdb/cpp/write_batch_iter_helper.hpp -> build/lib.linux-x86_64-3.6/rocksdb/cpp
    running build_ext
    skipping 'rocksdb/_rocksdb.cpp' Cython extension (up-to-date)
    building 'rocksdb._rocksdb' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/rocksdb
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/python3.6m -c rocksdb/_rocksdb.cpp -o build/temp.linux-x86_64-3.6/rocksdb/_rocksdb.o -std=c++11 -O3 -Wall -Wextra -Wconversion -fno-strict-aliasing -fno-rtti
    rocksdb/_rocksdb.cpp: In function ‘PyObject* __pyx_pf_7rocksdb_8_rocksdb_19PyBloomFilterPolicy_4create_filter(__pyx_obj_7rocksdb_8_rocksdb_PyBloomFilterPolicy*, PyObject*)’:
    rocksdb/_rocksdb.cpp:7869:87: warning: conversion to ‘int’ from ‘std::vector<rocksdb::Slice>::size_type {aka long unsigned int}’ may alter its value [-Wconversion]
         __pyx_t_6->CreateFilter(py_rocks::vector_data(__pyx_v_c_keys), __pyx_v_c_keys.size(), (&__pyx_v_dst));
                                                                        ~~~~~~~~~~~~~~~~~~~^~
    rocksdb/_rocksdb.cpp: In function ‘int __pyx_pf_7rocksdb_8_rocksdb_17PlainTableFactory___init__(__pyx_obj_7rocksdb_8_rocksdb_PlainTableFactory*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyObject*, PyLongObject*, PyLongObject*)’:
    rocksdb/_rocksdb.cpp:13542:25: error: ‘struct rocksdb::PlainTableOptions’ has no member named ‘store_index_in_file’
       __pyx_v_table_options.store_index_in_file = __pyx_t_8;
                             ^~~~~~~~~~~~~~~~~~~
    rocksdb/_rocksdb.cpp: In function ‘PyObject* __Pyx_PyInt_From_rocksdb_3a__3a_CompressionType(rocksdb::CompressionType)’:
    rocksdb/_rocksdb.cpp:46834:74: warning: the result of the conversion is unspecified because ‘-1’ is outside the range of type ‘rocksdb::CompressionType’ [-Wconversion]
         const rocksdb::CompressionType neg_one = (rocksdb::CompressionType) -1, const_zero = (rocksdb::CompressionType) 0;
                                                                              ^
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python3 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-0zgeb9ns/python-rocksdb/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-c8pt_77u-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-0zgeb9ns/python-rocksdb/

My commands to install rocksdb were:

  1. Python package: sudo pip3 install python-rocksdb( I also tried using a virtualenv)

ubuntu:~/src/rocksdb$ mkdir build && cd build ... clipped ubuntu:~/src/rocksdb/build$ cmake .. ... clipped ubuntu:~/src/rocksdb/build$ make ... clipped ubuntu:~/src/rocksdb/build$ sudo make install-shared INSTALL_PATH=/usr make: *** No rule to make target 'install-shared'. Stop. ubuntu:~/src/rocksdb/build$ cd .. ubuntu:~/src/rocksdb$ sudo make install-shared INSTALL_PATH=/usr ... This seemed to work, but python-rocksdb still doesn't work ... ubuntu:~/src/rocksdb$ cd build ubuntu:~/src/rocksdb/build$ sudo make install ... clipped

The 2nd step was obviously after cloning the facebook/rocksdb repository.

kebab-mai-haddi avatar Jan 31 '19 12:01 kebab-mai-haddi

Was able to get one step further than @avisrivastava254084 by using a 5.13.x branch instead of master except now I'm getting this on the python import:

    import rocksdb
  File "/usr/local/lib/python3.7/site-packages/rocksdb/__init__.py", line 1, in <module>
    from ._rocksdb import *
ImportError: librocksdb.so.5.13: cannot open shared object file: No such file or directory

vangheem avatar Feb 06 '19 06:02 vangheem

@vangheem

Did you add the library path to $LD_LIBRARY_PATH?

twmht avatar Feb 06 '19 06:02 twmht

@twmht after setting it, now I'm getting:

ImportError: /usr/src/rocksdb/librocksdb.so.5.13: undefined symbol: ZDICT_isError

vangheem avatar Feb 16 '19 14:02 vangheem

Finally got it working downgrading to rocksdb v4.13.5.

vangheem avatar Feb 16 '19 14:02 vangheem

For any that care, here is what you need...

First, install dependency libraries:

apt-get install build-essential libsnappy-dev zlib1g-dev libbz2-dev \
    libgflags-dev liblz4-dev libzstd-dev git-core -y

Then, checkout a tag of the 4.x line of rocksdb:

git clone https://github.com/facebook/rocksdb.git --branch=v4.13.5 /usr/src/rocksdb

And finally, build the library:

cd /usr/src/rocksdb
make shared_lib
make install-shared INSTALL_PATH=/usr

Finally, install pyrocksdb with pip:

pip install Cython
pip install python-rocksdb

vangheem avatar Feb 16 '19 18:02 vangheem

Same issue on MacOS:

running build_ext
    skipping 'rocksdb/_rocksdb.cpp' Cython extension (up-to-date)
    building 'rocksdb._rocksdb' extension
    creating build/temp.macosx-10.14-x86_64-3.7
    creating build/temp.macosx-10.14-x86_64-3.7/rocksdb
    clang -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -I/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c rocksdb/_rocksdb.cpp -o build/temp.macosx-10.14-x86_64-3.7/rocksdb/_rocksdb.o -std=c++11 -O3 -Wall -Wextra -Wconversion -fno-strict-aliasing -fno-rtti -mmacosx-version-min=10.7 -stdlib=libc++
    rocksdb/_rocksdb.cpp:549:10: fatal error: 'rocksdb/slice.h' file not found
    #include "rocksdb/slice.h"
             ^~~~~~~~~~~~~~~~~
    1 error generated.
    error: command 'clang' failed with exit status 1

ariesdevil avatar Feb 28 '19 12:02 ariesdevil

@vangheem that didn't work for me unfortunately, but I was able to install it following these instructions https://github.com/baraiyaraj/python-rocksdb-/blob/master/install_steps. I recommend it if that suggestion doesn't work.

axsaucedo avatar Mar 16 '19 15:03 axsaucedo

e.h" ^~~~~~~~~~~~~

Hi, You must intsall rocksdb and Cython on your local machine first. I assume you are using python 3.6 do following steps: git clone https://github.com/facebook/rocksdb.git cd rocksdb mkdir build && cd build cmake .. make sudo make install INSTALL_PATH=/usr Now you have rocksdb installed, Then make a new python virtual environment: pip install python-rocksdb or pip install git+git://github.com/twmht/python-rocksdb.git

xiabai84 avatar Aug 20 '19 14:08 xiabai84