twmht / python-rocksdb

Python bindings for RocksDB
BSD 3-Clause "New" or "Revised" License
274 stars 89 forks source link

errors while pip3 install python-rocksdb: Special method __le__ must be implemented via __richcmp__ #96

Closed rica01 closed 3 years ago

rica01 commented 3 years ago

Hello friends.

Im trying to install this on a ubuntu with python 3.6.9. I managed to install rocks but while doing the pip installation of python-rocksdb, I hit several errors of this type:

Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return other < self

        def __le__(self, other):
            return not other < self

        def __ge__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:828:4: Special method __ge__ must be implemented via __richcmp__

any ideas on how to fix that?

-Ricardo

iFA88 commented 3 years ago

Something is wrong with your python.. i have used this with 3.4 3.7 3.8 even 3.9 without any problem.. Please paste the whole command and the stdout what you running. And a pip3 --version also please.

rica01 commented 3 years ago

here you go kind sir:

[ricardo@bart]$ pip3 --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 3.6)
[ricardo@bart]$ pip3 install python-rocksdb
Collecting python-rocksdb
  Using cached https://files.pythonhosted.org/packages/94/81/9a8e498a26ec34da9e1ae87e831468aedb4a6ba42aa9ea779b97896cfea7/python-rocksdb-0.7.0.tar.gz
Requirement already satisfied: setuptools>=25 in /usr/lib/python2.7/dist-packages (from python-rocksdb)
Building wheels for collected packages: python-rocksdb
  Running setup.py bdist_wheel for python-rocksdb ... error
  Complete output from command /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ubkmf5jc/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/tmpx72fduw2pip-wheel- --python-tag cp36:
  running bdist_wheel
  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/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
  copying rocksdb/errors.py -> build/lib.linux-x86_64-3.6/rocksdb
  creating 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/test_options.py -> build/lib.linux-x86_64-3.6/rocksdb/tests
  copying rocksdb/tests/__init__.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
  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
  cythoning rocksdb/_rocksdb.pyx to rocksdb/_rocksdb.cpp

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          cdef _ColumnFamilyHandle real_handle = self._ref()
          if real_handle is None:
              raise ValueError(f"{self} is no longer a valid ColumnFamilyHandle!")
          return real_handle.handle

      def __eq__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:801:4: Special method __eq__ must be implemented via __richcmp__

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
                  and self.id == fast_other.id
                  and self._ref == fast_other._ref
              )
          return False

      def __lt__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:812:4: Special method __lt__ must be implemented via __richcmp__

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          if isinstance(other, ColumnFamilyHandle):
              return self.id < other.id
          return NotImplemented

      # Since @total_ordering isn't a thing for cython
      def __ne__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:819:4: Special method __ne__ must be implemented via __richcmp__

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

      # Since @total_ordering isn't a thing for cython
      def __ne__(self, other):
          return not self == other

      def __gt__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:822:4: Special method __gt__ must be implemented via __richcmp__

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return not self == other

      def __gt__(self, other):
          return other < self

      def __le__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:825:4: Special method __le__ must be implemented via __richcmp__

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return other < self

      def __le__(self, other):
          return not other < self

      def __ge__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:828:4: Special method __ge__ must be implemented via __richcmp__
  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/mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/include -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:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
   #error Do not use this file, it is the result of a failed Cython compilation.
    ^~~~~
  error: command 'x86_64-linux-gnu-gcc' 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 /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ubkmf5jc/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-funayfvz-record/install-record.txt --single-version-externally-managed --compile --install-headers /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/include/site/python3.6/python-rocksdb:
    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/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
    copying rocksdb/errors.py -> build/lib.linux-x86_64-3.6/rocksdb
    creating 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/test_options.py -> build/lib.linux-x86_64-3.6/rocksdb/tests
    copying rocksdb/tests/__init__.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
    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
    cythoning rocksdb/_rocksdb.pyx to rocksdb/_rocksdb.cpp

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            cdef _ColumnFamilyHandle real_handle = self._ref()
            if real_handle is None:
                raise ValueError(f"{self} is no longer a valid ColumnFamilyHandle!")
            return real_handle.handle

        def __eq__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:801:4: Special method __eq__ must be implemented via __richcmp__

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                    and self.id == fast_other.id
                    and self._ref == fast_other._ref
                )
            return False

        def __lt__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:812:4: Special method __lt__ must be implemented via __richcmp__

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            if isinstance(other, ColumnFamilyHandle):
                return self.id < other.id
            return NotImplemented

        # Since @total_ordering isn't a thing for cython
        def __ne__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:819:4: Special method __ne__ must be implemented via __richcmp__

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

        # Since @total_ordering isn't a thing for cython
        def __ne__(self, other):
            return not self == other

        def __gt__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:822:4: Special method __gt__ must be implemented via __richcmp__

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return not self == other

        def __gt__(self, other):
            return other < self

        def __le__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:825:4: Special method __le__ must be implemented via __richcmp__

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return other < self

        def __le__(self, other):
            return not other < self

        def __ge__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:828:4: Special method __ge__ must be implemented via __richcmp__
    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/mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/include -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:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
     #error Do not use this file, it is the result of a failed Cython compilation.
      ^~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-ubkmf5jc/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-funayfvz-record/install-record.txt --single-version-externally-managed --compile --install-headers /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/include/site/python3.6/python-rocksdb" failed with error code 1 in /tmp/pip-build-ubkmf5jc/python-rocksdb/
iFA88 commented 3 years ago

This is definitely weird: pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 3.6) That means you mixed up python2 libs with python3.

iFA88 commented 3 years ago

I dont know how can you fix that.. but maybe a python compile/install can help.. I recommend to download the latest stable python: https://www.python.org/ftp/python/3.9.6/Python-3.9.6.tar.xz Login as root (su) for installation: Unpack, then:

./configure
make
make test
make install

May you need install some lib when configure fails.

When the installation has been finished check your python version: python3 --version If you have 3.9 thats great.

You may should reinstall pip: Download https://bootstrap.pypa.io/get-pip.py then python3 get-pip.py

rica01 commented 3 years ago

definetly a problem with Python. But i cannot recompile, its a server and a ton of people use it. Let me see what i can do...

iFA88 commented 3 years ago

In that case you can install alternative with make altinstall instead of make install. With that you dont overwrite anything.

rica01 commented 3 years ago

Hello @iFA88. I believe I fixed my python installation but i still find the same error with Cython.

Cython                0.26.1
15:55:29 || ~/sepsis/rocksdb/build
[ricardo@bart]$ python
Python 3.6.9 (default, Jan 26 2021, 15:33:00) 
[GCC 8.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
5:56:15 || ~/sepsis/rocksdb/build
[ricardo@bart]$ pip -V
pip 21.2.3 from /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/lib/python3.6/site-packages/pip-21.2.3-py3.6.egg/pip (python 3.6)

and after issues pip install python-rocksdb:

(sepsis_py_venv) (base) 
15:49:34 || ~/sepsis/rocksdb
[ricardo@bart]$ pip install python-rocksdb
Collecting python-rocksdb
  Using cached python-rocksdb-0.7.0.tar.gz (219 kB)
Requirement already satisfied: setuptools>=25 in /usr/lib/python2.7/dist-packages (from python-rocksdb) (39.0.1)
Building wheels for collected packages: python-rocksdb
  Building wheel for python-rocksdb (setup.py) ... error
  ERROR: Command errored out with exit status 1:
   command: /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-aw0_pkky/python-rocksdb_a6ae572284eb44a394b5420d5a55a589/setup.py'"'"'; __file__='"'"'/tmp/pip-install-aw0_pkky/python-rocksdb_a6ae572284eb44a394b5420d5a55a589/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-rqq7vtla
       cwd: /tmp/pip-install-aw0_pkky/python-rocksdb_a6ae572284eb44a394b5420d5a55a589/
  Complete output (145 lines):
  running bdist_wheel
  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/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
  copying rocksdb/errors.py -> build/lib.linux-x86_64-3.6/rocksdb
  creating 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/test_options.py -> build/lib.linux-x86_64-3.6/rocksdb/tests
  copying rocksdb/tests/__init__.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
  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
  cythoning rocksdb/_rocksdb.pyx to rocksdb/_rocksdb.cpp

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          cdef _ColumnFamilyHandle real_handle = self._ref()
          if real_handle is None:
              raise ValueError(f"{self} is no longer a valid ColumnFamilyHandle!")
          return real_handle.handle

      def __eq__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:801:4: Special method __eq__ must be implemented via __richcmp__

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
                  and self.id == fast_other.id
                  and self._ref == fast_other._ref
              )
          return False

      def __lt__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:812:4: Special method __lt__ must be implemented via __richcmp__

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          if isinstance(other, ColumnFamilyHandle):
              return self.id < other.id
          return NotImplemented

      # Since @total_ordering isn't a thing for cython
      def __ne__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:819:4: Special method __ne__ must be implemented via __richcmp__

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

      # Since @total_ordering isn't a thing for cython
      def __ne__(self, other):
          return not self == other

      def __gt__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:822:4: Special method __gt__ must be implemented via __richcmp__

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return not self == other

      def __gt__(self, other):
          return other < self

      def __le__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:825:4: Special method __le__ must be implemented via __richcmp__

  Error compiling Cython file:
  ------------------------------------------------------------
  ...
          return other < self

      def __le__(self, other):
          return not other < self

      def __ge__(self, other):
     ^
  ------------------------------------------------------------

  rocksdb/_rocksdb.pyx:828:4: Special method __ge__ must be implemented via __richcmp__
  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/mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/include -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:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
   #error Do not use this file, it is the result of a failed Cython compilation.
    ^~~~~
  error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
  ----------------------------------------
  ERROR: 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
    ERROR: Command errored out with exit status 1:
     command: /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-aw0_pkky/python-rocksdb_a6ae572284eb44a394b5420d5a55a589/setup.py'"'"'; __file__='"'"'/tmp/pip-install-aw0_pkky/python-rocksdb_a6ae572284eb44a394b5420d5a55a589/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-it_s1abb/install-record.txt --single-version-externally-managed --compile --install-headers /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/include/site/python3.6/python-rocksdb
         cwd: /tmp/pip-install-aw0_pkky/python-rocksdb_a6ae572284eb44a394b5420d5a55a589/
    Complete output (145 lines):
    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/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
    copying rocksdb/errors.py -> build/lib.linux-x86_64-3.6/rocksdb
    creating 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/test_options.py -> build/lib.linux-x86_64-3.6/rocksdb/tests
    copying rocksdb/tests/__init__.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
    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
    cythoning rocksdb/_rocksdb.pyx to rocksdb/_rocksdb.cpp

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            cdef _ColumnFamilyHandle real_handle = self._ref()
            if real_handle is None:
                raise ValueError(f"{self} is no longer a valid ColumnFamilyHandle!")
            return real_handle.handle

        def __eq__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:801:4: Special method __eq__ must be implemented via __richcmp__

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
                    and self.id == fast_other.id
                    and self._ref == fast_other._ref
                )
            return False

        def __lt__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:812:4: Special method __lt__ must be implemented via __richcmp__

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            if isinstance(other, ColumnFamilyHandle):
                return self.id < other.id
            return NotImplemented

        # Since @total_ordering isn't a thing for cython
        def __ne__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:819:4: Special method __ne__ must be implemented via __richcmp__

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

        # Since @total_ordering isn't a thing for cython
        def __ne__(self, other):
            return not self == other

        def __gt__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:822:4: Special method __gt__ must be implemented via __richcmp__

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return not self == other

        def __gt__(self, other):
            return other < self

        def __le__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:825:4: Special method __le__ must be implemented via __richcmp__

    Error compiling Cython file:
    ------------------------------------------------------------
    ...
            return other < self

        def __le__(self, other):
            return not other < self

        def __ge__(self, other):
       ^
    ------------------------------------------------------------

    rocksdb/_rocksdb.pyx:828:4: Special method __ge__ must be implemented via __richcmp__
    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/mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/include -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:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
     #error Do not use this file, it is the result of a failed Cython compilation.
      ^~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    ----------------------------------------
ERROR: Command errored out with exit status 1: /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/bin/python3.6 -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-aw0_pkky/python-rocksdb_a6ae572284eb44a394b5420d5a55a589/setup.py'"'"'; __file__='"'"'/tmp/pip-install-aw0_pkky/python-rocksdb_a6ae572284eb44a394b5420d5a55a589/setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) else io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /tmp/pip-record-it_s1abb/install-record.txt --single-version-externally-managed --compile --install-headers /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/include/site/python3.6/python-rocksdb Check the logs for full command output.
iFA88 commented 3 years ago

Check the log output: Requirement already satisfied: setuptools>=25 in /usr/lib/python2.7/dist-packages (from python-rocksdb) (39.0.1)

iFA88 commented 3 years ago

What you get for this command? : python -c "import sys; print(sys.version_info);print('\n'.join(sys.path))"

rica01 commented 3 years ago
16:08:16 || ~/sepsis/rocksdb/build
[ricardo@bart]$ python -c "import sys; print(sys.version_info);print('\n'.join(sys.path))"
sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0)

/mnt/compgen/inhouse/lib/python2.7/site-packages/VaPoR-0.0.1-py2.7-linux-x86_64.egg
/mnt/compgen/inhouse/lib/python2.7/site-packages/svtyper-0.7.0-py2.7.egg
/mnt/compgen/inhouse/lib/python2.7/site-packages/cytoolz-0.9.0.1-py2.7-linux-x86_64.egg
/mnt/compgen/inhouse/lib/python2.7/site-packages/toolz-0.9.0-py2.7.egg
/usr/lib/python2.7/dist-packages
/mnt/compgen/inhouse/lib/python2.7/site-packages
/usr/lib/python36.zip
/usr/lib/python3.6
/usr/lib/python3.6/lib-dynload
/mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/lib/python3.6/site-packages

Check the log output: Requirement already satisfied: setuptools>=25 in /usr/lib/python2.7/dist-packages (from python-rocksdb) (39.0.1)

Why would an already satisfied requirement cause an error?

iFA88 commented 3 years ago

Paths are still mixed with older python version.

This: Requirement already satisfied: setuptools>=25 in /usr/lib/python2.7/dist-packages (from python-rocksdb) (39.0.1)

iFA88 commented 3 years ago

You need also activate your virtual python environment to your terminal: source /mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/bin/activate After this do the command again: python -c "import sys; print(sys.version_info);print('\n'.join(sys.path))"

rica01 commented 3 years ago

the venv is already activated:

16:18:27 || ~/sepsis/rocksdb/build
[ricardo@bart]$ python -c "import sys; print(sys.version_info);print('\n'.join(sys.path))"
sys.version_info(major=3, minor=6, micro=9, releaselevel='final', serial=0)

/mnt/compgen/inhouse/lib/python2.7/site-packages/VaPoR-0.0.1-py2.7-linux-x86_64.egg
/mnt/compgen/inhouse/lib/python2.7/site-packages/svtyper-0.7.0-py2.7.egg
/mnt/compgen/inhouse/lib/python2.7/site-packages/cytoolz-0.9.0.1-py2.7-linux-x86_64.egg
/mnt/compgen/inhouse/lib/python2.7/site-packages/toolz-0.9.0-py2.7.egg
/usr/lib/python2.7/dist-packages
/mnt/compgen/inhouse/lib/python2.7/site-packages
/usr/lib/python36.zip
/usr/lib/python3.6
/usr/lib/python3.6/lib-dynload
/mnt/compgen/homes/ricardo/sepsis/sepsis_py_venv/lib/python3.6/site-packages
iFA88 commented 3 years ago

Paths are definitely wrong. Maybe you should simple do what i recommended.. download latest python and make altinstall it.

rica01 commented 3 years ago

i cant do that =(

On Thu, Aug 12, 2021 at 4:23 PM iFA @.***> wrote:

Paths are definitely wrong. Maybe you should simple do what i recommended.. download latest python and make altinstall it.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/twmht/python-rocksdb/issues/96#issuecomment-897636487, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACWQWE7WLAXNDAUY7KXX6H3T4PDN3ANCNFSM5BVT2VCA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&utm_campaign=notification-email .

iFA88 commented 3 years ago

Sadly i can not help you, and this issue is not relevant for python-rocksdb library. Please close this issue and try to google for some solution for your issue. Thank you!

rica01 commented 3 years ago

Just wanted to thank you again.

I found the culprint in the PYTHONPATH variable, set systemwide on the bash scripts... After disabling it:

17:00:14 || ~/sepsis/rocksdb
[ricardo@bart]$ pip install python-rocksdb --force-reinstall
Collecting python-rocksdb
  Using cached python-rocksdb-0.7.0.tar.gz (219 kB)
Collecting setuptools>=25
  Using cached setuptools-57.4.0-py3-none-any.whl (819 kB)
Building wheels for collected packages: python-rocksdb
  Building wheel for python-rocksdb (setup.py) ... done
  Created wheel for python-rocksdb: filename=python_rocksdb-0.7.0-cp36-cp36m-linux_x86_64.whl size=1501662 sha256=b5489ec78519ededd4d1f2b55799e975e7959a6e82b5f3b0d1e5d2f4addeb835
  Stored in directory: /mnt/compgen/homes/ricardo/.cache/pip/wheels/5a/95/15/7fd89efbd81e03bc34f1cd656bb3599642632e0049c4895a4d
Successfully built python-rocksdb
Installing collected packages: setuptools, python-rocksdb
  Attempting uninstall: setuptools
    Found existing installation: setuptools 57.4.0
    Uninstalling setuptools-57.4.0:
      Successfully uninstalled setuptools-57.4.0
Successfully installed python-rocksdb-0.7.0 setuptools-57.4.0
(sepsis_py_venv) (base) 
iFA88 commented 3 years ago

Great! :)

exzhawk commented 2 years ago

I encountered the same error today. It is a Ubuntu 18.04.2 LTS with Python 3.6.9. Updating Cython from 0.26.1 to 0.29.32 solved it. Maybe set a higher Cython version requirement in the setup.py file?