PIP install pylibmc installation failure and its solution. During installation, the following errors are reported, and there may be other errors, similar to the following:
pip install pylibmc==1.6.1
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pylibmc==1.6.1
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a7/0c/f7a3af34b05c167a69ed1fc330b06b658dac4ab25b8632c52d1022dd5337/pylibmc-1.6.1.tar.gz (64 kB)
Building wheels for collected packages: pylibmc
Building wheel for pylibmc (setup.py) ... error
ERROR: Command errored out with exit status 1:
command: /Users/yangchangjia/PycharmProjects/Nox/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/setup.py'"'"'; __file__='"'"'/private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-wheel-73t1n0ft
cwd: /private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/
Complete output (28 lines):
/private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/setup.py:98: DeprecationWarning: 'U' mode is deprecated
with open("README.rst", "U", encoding="utf-8") as r:
/private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/setup.py:100: DeprecationWarning: 'U' mode is deprecated
with open("src/pylibmc-version.h", "U", encoding="utf-8") as r:
running bdist_wheel
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.8
creating build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/autoconf.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/pools.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/client.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/__init__.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/test.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/consts.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/__main__.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
running build_ext
building '_pylibmc' extension
creating build/temp.macosx-10.15-x86_64-3.8
creating build/temp.macosx-10.15-x86_64-3.8/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -DUSE_ZLIB -I/Users/yangchangjia/PycharmProjects/Nox/venv/include -I/Users/yangchangjia/.pyenv/versions/3.8.6/include/python3.8 -c src/_pylibmcmodule.c -o build/temp.macosx-10.15-x86_64-3.8/src/_pylibmcmodule.o -fno-strict-aliasing -std=c99
In file included from src/_pylibmcmodule.c:34:
src/_pylibmcmodule.h:42:10: fatal error: 'libmemcached/memcached.h' file not found
#include <libmemcached/memcached.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for pylibmc
Running setup.py clean for pylibmc
Failed to build pylibmc
Installing collected packages: pylibmc
Running setup.py install for pylibmc ... error
ERROR: Command errored out with exit status 1:
command: /Users/yangchangjia/PycharmProjects/Nox/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/setup.py'"'"'; __file__='"'"'/private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-record-tox14kc6/install-record.txt --single-version-externally-managed --compile --install-headers /Users/yangchangjia/PycharmProjects/Nox/venv/include/site/python3.8/pylibmc
cwd: /private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/
Complete output (28 lines):
/private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/setup.py:98: DeprecationWarning: 'U' mode is deprecated
with open("README.rst", "U", encoding="utf-8") as r:
/private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/setup.py:100: DeprecationWarning: 'U' mode is deprecated
with open("src/pylibmc-version.h", "U", encoding="utf-8") as r:
running install
running build
running build_py
creating build
creating build/lib.macosx-10.15-x86_64-3.8
creating build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/autoconf.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/pools.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/client.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/__init__.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/test.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/consts.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
copying src/pylibmc/__main__.py -> build/lib.macosx-10.15-x86_64-3.8/pylibmc
running build_ext
building '_pylibmc' extension
creating build/temp.macosx-10.15-x86_64-3.8
creating build/temp.macosx-10.15-x86_64-3.8/src
clang -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/usr/include -DUSE_ZLIB -I/Users/yangchangjia/PycharmProjects/Nox/venv/include -I/Users/yangchangjia/.pyenv/versions/3.8.6/include/python3.8 -c src/_pylibmcmodule.c -o build/temp.macosx-10.15-x86_64-3.8/src/_pylibmcmodule.o -fno-strict-aliasing -std=c99
In file included from src/_pylibmcmodule.c:34:
src/_pylibmcmodule.h:42:10: fatal error: 'libmemcached/memcached.h' file not found
#include <libmemcached/memcached.h>
^~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.
error: command 'clang' failed with exit status 1
----------------------------------------
ERROR: Command errored out with exit status 1: /Users/yangchangjia/PycharmProjects/Nox/venv/bin/python -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/setup.py'"'"'; __file__='"'"'/private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-install-14fh8zn_/pylibmc/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/x7/zprpyfhx3h3g5qs3c_z_gxqc0000gn/T/pip-record-tox14kc6/install-record.txt --single-version-externally-managed --compile --install-headers /Users/yangchangjia/PycharmProjects/Nox/venv/include/site/python3.8/pylibmc Check the logs for full command output.
Solution:
brew install libmemcached
pip install wheel
pip install pylibmc
Installation successful:
pip install pylibmc
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pylibmc
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/a7/0c/f7a3af34b05c167a69ed1fc330b06b658dac4ab25b8632c52d1022dd5337/pylibmc-1.6.1.tar.gz (64 kB)
Building wheels for collected packages: pylibmc
Building wheel for pylibmc (setup.py) ... done
Created wheel for pylibmc: filename=pylibmc-1.6.1-cp38-cp38-macosx_10_15_x86_64.whl size=33323 sha256=9a8ecb4933b8a455b7ffe9db042011f3a9865c18441b8e5204d843bc0e6da1a3
Stored in directory: /Users/yangchangjia/Library/Caches/pip/wheels/a1/8e/7e/d1b6684901c01de15a45efb8b5172c1dc7b9c6a7386d369839
Successfully built pylibmc
Installing collected packages: pylibmc
Successfully installed pylibmc-1.6.1