Rocksdb 未定义符号:ZSTD_versionNumber Cpython

Rocksdb undefined symbol: ZSTD_versionNumber Cpython

[2021-06-18 17:52:53,711: ERROR]: [^Worker]: Error: ImproperlyConfigured('RocksDB bindings not installed? pip install python-rocksdb',) 
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/faust/stores/rocksdb.py", line 159, in __init__
    import rocksdb as _rocksdb  # noqa: F401
  File "/usr/local/lib/python3.6/site-packages/rocksdb/__init__.py", line 1, in <module>
    from ._rocksdb import *
ImportError: /usr/local/lib/python3.6/site-packages/rocksdb/_rocksdb.cpython-36m-x86_64-linux-gnu.so: undefined symbol: ZSTD_versionNumber

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/mode/worker.py", line 264, in execute_from_commandline
    self.loop.run_until_complete(self._starting_fut)
  File "/usr/local/lib/python3.6/asyncio/base_events.py", line 488, in run_until_complete
    return future.result()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 719, in start
    await self._default_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 726, in _default_start
    await self._actually_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 750, in _actually_start
    await child.maybe_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 778, in maybe_start
    await self.start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 719, in start
    await self._default_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 726, in _default_start
    await self._actually_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 750, in _actually_start
    await child.maybe_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 778, in maybe_start
    await self.start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 719, in start
    await self._default_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 726, in _default_start
    await self._actually_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 743, in _actually_start
    await self.on_start()
  File "/usr/local/lib/python3.6/site-packages/faust/tables/manager.py", line 130, in on_start
    await self._update_channels()
  File "/usr/local/lib/python3.6/site-packages/faust/tables/manager.py", line 140, in _update_channels
    await table.maybe_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 778, in maybe_start
    await self.start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 719, in start
    await self._default_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 726, in _default_start
    await self._actually_start()
  File "/usr/local/lib/python3.6/site-packages/mode/services.py", line 743, in _actually_start
    await self.on_start()
  File "/usr/local/lib/python3.6/site-packages/faust/tables/base.py", line 195, in on_start
    await self.add_runtime_dependency(self.data)
  File "/usr/local/lib/python3.6/site-packages/faust/tables/base.py", line 190, in data
    self._data = self._new_store()
  File "/usr/local/lib/python3.6/site-packages/faust/tables/base.py", line 171, in _new_store
    return self._new_store_by_url(self._store or self.app.conf.store)
  File "/usr/local/lib/python3.6/site-packages/faust/tables/base.py", line 182, in _new_store_by_url
    options=self.options,
  File "/usr/local/lib/python3.6/site-packages/faust/stores/rocksdb.py", line 161, in __init__
    raise error from exc
faust.exceptions.ImproperlyConfigured: RocksDB bindings not installed? pip install python-rocksdb

我使用的是python 3.6,通过以下命令将RocksDB安装到容器中:

  9 RUN git clone https://github.com/facebook/rocksdb.git /tmp/roc    ksdb
 10 WORKDIR /tmp/rocksdb
 11 RUN make shared_lib INSTALL_PATH=/usr && make install && rm -rf /tmp/rocksdb
 12 
 13 ENV CGO_CFLAGS  "-I/usr/local/include"
 14 ENV CGO_LDFLAGS "-L/usr/local/lib -lrocksdb -lstdc++ -lm -lz -lbz2 -lsnappy"
 15 ENV LD_LIBRARY_PATH="/usr/local/lib"

我看来是版本问题。不知道如何解决它。尝试将 rocksdb 和 python-rocksdb 添加到需求文件中。但也不起作用。该服务之前工作。但是,最后一个可用的 docker 容器是一年前构建的。这次我尝试重新构建时会出现许多错误。 感谢您的帮助!

不要使用任何最新版本的自动构建,将版本固定到最新的、经过测试的、工作的版本。看起来这个项目使用标签来表示发布版本。您需要弄清楚上次构建的日期,转到存储库,找到紧接在上次工作构建日期之前的 tag 并在 运行 make 之前检查它.

RUN git clone https://github.com/facebook/rocksdb.git /tmp/rocksdb
WORKDIR /tmp/rocksdb
RUN git checkout tags/<tag_name>
RUN make shared_lib INSTALL_PATH=/usr && make install && rm -rf /tmp/rocksdb

<tag_name> 替换为适当标签的名称。例如,假设您要安装版本 6.1.1.

RUN git checkout tags/v6.1.1

您可能需要尝试大约那个时间的几个标签,因为最后一个工作构建实际上在 master 分支上安装了最新的提交。成功构建后,您可以开始测试新版本的 rocksdb 以找到适用于您的应用程序的最新版本。

另一件事:当你在这里的时候,固定你的docker图像的版本。例如:不要使用 debian:latest,使用 debian:9.13.