git-explode icon indicating copy to clipboard operation
git-explode copied to clipboard

install pygit2: fatal error: 'git2.h' file not found

Open telephon opened this issue 7 years ago • 3 comments

maybe this is not a git-explode issue, but still I've run into it:

sudo pip install git-deps

results in:

 creating build/temp.macosx-10.11-x86_64-2.7
    building '_pygit2' extension
    creating build/temp.macosx-10.11-x86_64-2.7/src
    clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/usr/local/include -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python@2/2.7.15/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/blob.c -o build/temp.macosx-10.11-x86_64-2.7/src/blob.o
    In file included from src/blob.c:30:
    src/blob.h:33:10: fatal error: 'git2.h' file not found
    #include <git2.h>
             ^
    1 error generated.
    error: command 'clang' failed with exit status 1
    
    ----------------------------------------
Command "/usr/local/opt/python@2/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-install-u4aDlM/pygit2/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/tmp/pip-record-_osVGz/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-install-u4aDlM/pygit2/

telephon avatar May 29 '18 17:05 telephon

this looks like missing libgit2-devel

also please never ever use sudo pip install - it tends to break stuff the packge manager owns

RonnyPfannschmidt avatar Jun 15 '18 07:06 RonnyPfannschmidt

ok, thanks! I must have read it in some description.

telephon avatar Jun 15 '18 14:06 telephon

If anybody is using a deb-based distribution, there the package name is libgit2-dev.

jugmac00 avatar Jan 15 '22 17:01 jugmac00