How Do You Install python-snappy on an Ubuntu/Debian Linux Server?

Problem scenario
You are trying to install python-snappy on Ubuntu (or a Debian distribution of) Linux.  You go here and find no obvious dependencies or prerequisites:

But when you try to install it, you run "python build" and get an error like this:

"/usr/lib/python2.7/distutils/ UserWarning: Unknown distribution option: 'install_requires'
running build
running build_py
package init file '' not found (or not a regular file)
package init file '' not found (or not a regular file)
running build_ext
building '_snappy' extension
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 -o build/temp.linux-x86_64-2.7/snappymodule.o
x86_64-linux-gnu-gcc: error trying to exec 'cc1plus': execvp: No such file or directory
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1"

or an error like this:

"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 -o build/temp.linux-x86_64-2.7/snappymodule.o
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ fatal error: Python.h: No such file or directory
compilation terminated."

What should you do to install snappy for Python?

Run these four commands:

sudo apt-get -y install python-pip

sudo su -

pip install snappy


#If you are not allowed to leave pip installed, run this command: "sudo apt-get -y remove python-pip" with no quotes

Leave a comment

Your email address will not be published. Required fields are marked *