pythondjangoinstallationpip

pylibmc installation error using pip in python


I am trying to install pylibmc using pip inside my virtual env and getting the below error

pip install pylibmc
Downloading/unpacking pylibmc
  Downloading pylibmc-1.3.0.tar.gz (49kB): 49kB downloaded
  Running setup.py egg_info for package pylibmc

    warning: no files found matching 'LICENSE'
    warning: no files found matching 'runtests.py'
    warning: no files found matching '*.py' under directory 'pylibmc'
Installing collected packages: pylibmc
  Running setup.py install for pylibmc
    building '_pylibmc' extension
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/usr/include/python2.7 -c src/_pylibmcmodule.c -o build/temp.linux-x86_64-2.7/src/_pylibmcmodule.o -fno-strict-aliasing
    In file included from src/_pylibmcmodule.c:34:0:
    src/_pylibmcmodule.h:42:36: fatal error: libmemcached/memcached.h: No such file or directory
     #include <libmemcached/memcached.h>
                                        ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    Complete output from command /home/satyag/.virtualenvs/inwell/bin/python -c "import setuptools;__file__='/home/satyag/.virtualenvs/inwell/build/pylibmc/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-j2sj7j-record/install-record.txt --single-version-externally-managed --install-headers /home/satyag/.virtualenvs/inwell/include/site/python2.7:
    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/pylibmc

copying src/pylibmc/__main__.py -> build/lib.linux-x86_64-2.7/pylibmc

copying src/pylibmc/test.py -> build/lib.linux-x86_64-2.7/pylibmc

copying src/pylibmc/__init__.py -> build/lib.linux-x86_64-2.7/pylibmc

copying src/pylibmc/client.py -> build/lib.linux-x86_64-2.7/pylibmc

copying src/pylibmc/pools.py -> build/lib.linux-x86_64-2.7/pylibmc

copying src/pylibmc/consts.py -> build/lib.linux-x86_64-2.7/pylibmc

running build_ext

building '_pylibmc' extension

creating build/temp.linux-x86_64-2.7

creating build/temp.linux-x86_64-2.7/src

x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/usr/include/python2.7 -c src/_pylibmcmodule.c -o build/temp.linux-x86_64-2.7/src/_pylibmcmodule.o -fno-strict-aliasing

In file included from src/_pylibmcmodule.c:34:0:

src/_pylibmcmodule.h:42:36: fatal error: libmemcached/memcached.h: No such file or directory

 #include <libmemcached/memcached.h>

                                    ^

compilation terminated.

error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------
Cleaning up...
Command /home/user/.virtualenvs/proj/bin/python -c "import setuptools;__file__='/home/user/.virtualenvs/proj/build/pylibmc/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-j2sj7j-record/install-record.txt --single-version-externally-managed --install-headers /home/user/.virtualenvs/proj/include/site/python2.7 failed with error code 1 in /home/user/.virtualenvs/proj/build/pylibmc
Storing complete log in /home/user/.pip/pip.log

So why it is showing me error ? and how to avoid this error.

Edit

Also i tried in this way,

Downloaded the zip file manually at here https://pypi.python.org/pypi/pylibmc and runt the command python setup.py install and i got the below error

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/pylibmc
copying src/pylibmc/__main__.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/test.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/__init__.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/client.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/pools.py -> build/lib.linux-x86_64-2.7/pylibmc
copying src/pylibmc/consts.py -> build/lib.linux-x86_64-2.7/pylibmc
running build_ext
building '_pylibmc' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/src
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -DUSE_ZLIB -I/usr/include/python2.7 -c src/_pylibmcmodule.c -o build/temp.linux-x86_64-2.7/src/_pylibmcmodule.o -fno-strict-aliasing
In file included from src/_pylibmcmodule.c:34:0:
src/_pylibmcmodule.h:42:36: fatal error: libmemcached/memcached.h: No such file or directory
 #include <libmemcached/memcached.h>
                                    ^
compilation terminated.
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

Solution

  • Actually we need to install dev package like below

    sudo apt-get install libmemcached-dev