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:
https://pypi.python.org/pypi/python-snappy
But when you try to install it, you run "python setup.py build" and get an error like this:
"/usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
warnings.warn(msg)
running build
running build_py
package init file '__init__.py' not found (or not a regular file)
package init file '__init__.py' 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 snappymodule.cc -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 snappymodule.cc -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++
snappymodule.cc:28:20: fatal error: Python.h: No such file or directory
compilation terminated."
What should you do to install snappy for Python?
Solution
Run these four commands:
sudo apt-get -y install python-pip
sudo su -
pip install snappy
exit
#If you are not allowed to leave pip installed, run this command: "sudo apt-get -y remove python-pip" with no quotes