Ethan Ethan - 6 months ago 28
Linux Question

Installing plyvel with pip

I am getting this error when trying to install plyvel :

Running setup.py install for plyvel
Complete output from command /home/eytan/.virtualenvs/env/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-NVZgbQ/plyvel/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-jHZNqS-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/eytan/.virtualenvs/env/include/site/python2.7/plyvel:
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/plyvel
copying plyvel/__init__.py -> build/lib.linux-x86_64-2.7/plyvel
copying plyvel/_version.py -> build/lib.linux-x86_64-2.7/plyvel
running build_ext
building 'plyvel._plyvel' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/plyvel
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/python2.7 -c plyvel/_plyvel.cpp -o build/temp.linux-x86_64-2.7/plyvel/_plyvel.o -Wall -g
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
plyvel/_plyvel.cpp:359:24: fatal error: leveldb/db.h: No such file or directory
#include "leveldb/db.h"
^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Command "/home/eytan/.virtualenvs/env/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip-build-NVZgbQ/plyvel/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-jHZNqS-record/install-record.txt --single-version-externally-managed --compile --install-headers /home/eytan/.virtualenvs/env/include/site/python2.7/plyvel" failed with error code 1 in /tmp/pip-build-NVZgbQ/plyvel


Can someone explain what's going on and how can I solve it ?

Answer

You nee to install the leveldb development package.

On deb based distributions:

sudo apt-get install libleveldb-dev

On RPM based distributions:

sudo yum install leveldb-devel

Note that dnf is slowly but surely replacing yum. If your distribution uses dnf (e.g., Fedora 23 and newer), you can just drop it in there instead of yum:

sudo dnf install leveldb-devel
Comments