[Solved]-Fatal error: libmemcached/memcached.h: no such file or directory


You need to install the development header files via your OS package manager:

For example on Ubuntu:

sudo apt install libmemcached-dev


For m1 mac:

Try install/reinstall

brew install libmemcached

and then

pip install pylibmc

If you still face the issue then try:

pip install pylibmc --install-option="--with-libmemcached=/usr/local/Cellar/libmemcached/1.0.18/"

Please note: Change libmemcached path according to your machine and package version for eg in my case path is /opt/homebrew/Cellar/libmemcached/1.0.18_2/


Install libmemcached:

brew install libmemcached

now find the path in which libmemcached installed, it’ll be something like:

Now run the following command, replacing with your path:

LIBMEMCACHED=/usr/local/Cellar/libmemcached/1.0.18_2 pip install pylibmc

Leave a comment