4

I'm trying to install Python-RocksDB package.

I tried using sudo pip3 install python-rocksdb sudo pip install python-rocksdb

However, I get this message Requirement already satisfied: python-rocksdb in /usr/local/lib/python3.6/dist-packages

I also tried cloning the github repository and installing it from source. Somehow that doesn't get installed either. Is there anything else to resolve this?

RogerS
  • 1,322
  • 9
  • 11
Vivek
  • 165
  • 3
  • 9

3 Answers3

5

Install rocksdb and Cython.

Simplified :

Solution 1

pip install Cython
pip install python-rocksdb

Solution 2

pip install git+git://github.com/twmht/python-rocksdb.git

Try the manual method :

    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
BPDESILVA
  • 2,040
  • 5
  • 15
  • 35
4

This is how I installed in Ubuntu 20.04, without compiling rocksdb from scratch.

sudo apt install rocksdb-tools librocksdb5.17 librocksdb-dev libsnappy-dev liblz4-dev

After I could do this:

sudo pip3 install python-rocksdb

Then inside python3:

import rocksdb
# your python code using rocksdb
RogerS
  • 1,322
  • 9
  • 11
  • With a slight modification to `sudo apt install librocksdb-dev librocksdb5.8 libsnappy-dev liblz4-dev ` and then `pip3 install Cython python-rocksdb` I was able to install on Ubuntu 18.04 without any compilation. – Abhirup Das Mar 24 '22 at 08:11
  • @AbhirupDas you are installing an an older version of `librocksdb`, No? – Volatil3 Oct 03 '22 at 10:16
  • This was the only solution that worked for me – Volatil3 Oct 03 '22 at 10:16
1

Let it be for the future:

apt-get update
apt install -y \
gcc g++ python-dev librocksdb-dev build-essential \
libsnappy-dev zlib1g-dev libbz2-dev libgflags-dev \
liblz4-dev libzstd-dev curl
Serge
  • 1,416
  • 1
  • 15
  • 21