Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install pygit2 in Raspberry Pi 3 #19

Closed
mariocosme opened this issue Dec 2, 2017 · 7 comments
Closed

Can't install pygit2 in Raspberry Pi 3 #19

mariocosme opened this issue Dec 2, 2017 · 7 comments

Comments

@mariocosme
Copy link

mariocosme commented Dec 2, 2017

Hi! I'm trying to install bazarr on my rpi3 which is already running sonarr. All other depencies are installed with success except for this pygit2.

Already tried to install it differently but it didn't work as well.

Here is the log:

osmc@osmc:~/Downloads/bazarr$ python --version
Python 2.7.9
osmc@osmc:~/Downloads/bazarr$ sudo pip install -r requirements.txt
Requirement already satisfied: apscheduler in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 1))
Requirement already satisfied: babelfish in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 2))
Requirement already satisfied: bottle in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 3))
Requirement already satisfied: bottle-fdsend in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 4))
Requirement already satisfied: dogpile.cache in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 5))
Requirement already satisfied: enzyme in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 6))
Requirement already satisfied: Pillow in /usr/lib/python2.7/dist-packages (from -r requirements.txt (line 7))
Requirement already satisfied: py-pretty in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 8))
Requirement already satisfied: pycountry in /usr/local/lib/python2.7/dist-packages (from -r requirements.txt (line 9))
Collecting pygit2 (from -r requirements.txt (line 10))
  Using cached pygit2-0.26.2.tar.gz
    Complete output from command python setup.py egg_info:
    __pycache__/_cffi__x554e6eaax4850a773.c:185:18: fatal error: git2.h: No such file or directory
     #include <git2.h>
                      ^
    compilation terminated.
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-sDumAf/pygit2/setup.py", line 61, in <module>
        ffi.verify(preamble, **C_KEYWORDS)
      File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 340, in verify
        lib = self.verifier.load_library()
      File "/usr/lib/python2.7/dist-packages/cffi/verifier.py", line 74, in load_library
        self._compile_module()
      File "/usr/lib/python2.7/dist-packages/cffi/verifier.py", line 139, in _compile_module
        outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
      File "/usr/lib/python2.7/dist-packages/cffi/ffiplatform.py", line 25, in compile
        outputfilename = _build(tmpdir, ext)
      File "/usr/lib/python2.7/dist-packages/cffi/ffiplatform.py", line 51, in _build
        raise VerificationError('%s: %s' % (e.__class__.__name__, e))
    cffi.ffiplatform.VerificationError: CompileError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-sDumAf/pygit2/

As you can see, I'm using python version 2.7.9. Any ideas?

@morpheus65535
Copy link
Owner

morpheus65535 commented Dec 2, 2017

Hi Mario,

First, thank you to give a try to bazarr!

pygit2 is failing to install because you don't have libgit2 install on osmc. You probably gonna need to build it from source.

Be advise that you are using the version 0.26.x of pygit2 witch is good. You need the same version of libgit2 so it could work fine.

https://libgit2.github.com/docs/guides/build-and-link/

If you take a look at dockerfile, you going to see witch package need to be installer:
apt-get install -y build-essential python-dev python-pip python-setuptools libjpeg-dev zlib1g-dev git libgit2-dev libffi-dev
Be aware that the libgit2 package is only available on Debian since version 10 Buster. Like I said, building from source is probably what you're gonna have to do.

Try this and come back to give me some feeback!

@mariocosme
Copy link
Author

Thanks for the quick reply. I installed all those packages (including libgit2-dev) without any issues. When I now run the pip install -r requirements.txt is does exit with a different error but it is still unable to install pygit2 successfully.

Here is the trace log (too big for the ssh terminal so I just paste the end):

    In file included from __pycache__/_cffi__x554e6eaax4850a773.c:3:0:
    __pycache__/_cffi__x554e6eaax4850a773.c:9673:21: error: invalid use of undefined type 'struct git_stash_apply_options'
         offsetof(struct git_stash_apply_options, progress_cb),
                         ^
    __pycache__/_cffi__x554e6eaax4850a773.c:9673:21: error: initializer element is not constant
    __pycache__/_cffi__x554e6eaax4850a773.c:9673:21: error: (near initialization for 'nums[8]')
    __pycache__/_cffi__x554e6eaax4850a773.c:9674:49: error: dereferencing pointer to incomplete type
         sizeof(((struct git_stash_apply_options *)0)->progress_cb),
                                                     ^
    __pycache__/_cffi__x554e6eaax4850a773.c:9674:49: error: request for member 'progress_cb' in something not a structure or union
    __pycache__/_cffi__x554e6eaax4850a773.c:9674:21: error: initializer element is not constant
         sizeof(((struct git_stash_apply_options *)0)->progress_cb),
                         ^
    __pycache__/_cffi__x554e6eaax4850a773.c:9674:21: error: (near initialization for 'nums[9]')
    In file included from __pycache__/_cffi__x554e6eaax4850a773.c:3:0:
    __pycache__/_cffi__x554e6eaax4850a773.c:9675:21: error: invalid use of undefined type 'struct git_stash_apply_options'
         offsetof(struct git_stash_apply_options, progress_payload),
                         ^
    __pycache__/_cffi__x554e6eaax4850a773.c:9675:21: error: initializer element is not constant
    __pycache__/_cffi__x554e6eaax4850a773.c:9675:21: error: (near initialization for 'nums[10]')
    __pycache__/_cffi__x554e6eaax4850a773.c:9676:49: error: dereferencing pointer to incomplete type
         sizeof(((struct git_stash_apply_options *)0)->progress_payload),
                                                     ^
    __pycache__/_cffi__x554e6eaax4850a773.c:9676:49: error: request for member 'progress_payload' in something not a structure or union
    __pycache__/_cffi__x554e6eaax4850a773.c:9676:21: error: initializer element is not constant
         sizeof(((struct git_stash_apply_options *)0)->progress_payload),
                         ^
    __pycache__/_cffi__x554e6eaax4850a773.c:9676:21: error: (near initialization for 'nums[11]')
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-SGUEA8/pygit2/setup.py", line 61, in <module>
        ffi.verify(preamble, **C_KEYWORDS)
      File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 340, in verify
        lib = self.verifier.load_library()
      File "/usr/lib/python2.7/dist-packages/cffi/verifier.py", line 74, in load_library
        self._compile_module()
      File "/usr/lib/python2.7/dist-packages/cffi/verifier.py", line 139, in _compile_module
        outputfilename = ffiplatform.compile(tmpdir, self.get_extension())
      File "/usr/lib/python2.7/dist-packages/cffi/ffiplatform.py", line 25, in compile
        outputfilename = _build(tmpdir, ext)
      File "/usr/lib/python2.7/dist-packages/cffi/ffiplatform.py", line 51, in _build
        raise VerificationError('%s: %s' % (e.__class__.__name__, e))
    cffi.ffiplatform.VerificationError: CompileError: command 'arm-linux-gnueabihf-gcc' failed with exit status 1

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-SGUEA8/pygit2/

@morpheus65535
Copy link
Owner

What is the version of libgit2 you've installed? If you've install it with apt, you can get the version using this command:
dpkg -s libgit2-dev

@mariocosme
Copy link
Author

osmc@osmc:~$  dpkg -s libgit2-dev
Package: libgit2-dev
Status: install ok installed
Priority: extra
Section: libdevel
Installed-Size: 1649
Maintainer: Russell Sim <russell.sim@gmail.com>
Architecture: armhf
Multi-Arch: same
Source: libgit2
Version: 0.21.1-3
Depends: libgit2-21 (= 0.21.1-3), libz-dev, libssl-dev
Description: low-level Git library (development files)
 libgit2 is a portable, pure C implementation of the Git
 distributed version control system core methods provided as a
 re-entrant link-able library with a solid API.
 .
 This package contains the development files for libgit2.
Homepage: http://libgit2.github.com/

@morpheus65535
Copy link
Owner

You’ve installed an incompatible version of libgit2. It’s too old.

You need to build it from source, as mentionned before.

You absolutely need the 0.26.x version of libgit2.

@mariocosme
Copy link
Author

Okay. Built and installed libgit2 from source as build instructions

Still getting an error when installing bazarr dependencies:

osmc@osmc:~/Downloads/libgit2-0.26.0/build$ sudo cmake --build . --target instal                                                              l
[ 21%] Built target git2
[100%] Built target libgit2_clar
Install the project...
-- Install configuration: "Debug"
-- Installing: /usr/local/lib/libgit2.so.0.26.0
-- Installing: /usr/local/lib/libgit2.so.26
-- Installing: /usr/local/lib/libgit2.so
-- Installing: /usr/local/lib/pkgconfig/libgit2.pc
-- Installing: /usr/local/include/git2
-- Installing: /usr/local/include/git2/buffer.h
-- Installing: /usr/local/include/git2/commit.h
-- Installing: /usr/local/include/git2/odb_backend.h
-- Installing: /usr/local/include/git2/trace.h
-- Installing: /usr/local/include/git2/repository.h
-- Installing: /usr/local/include/git2/tag.h
-- Installing: /usr/local/include/git2/reflog.h
-- Installing: /usr/local/include/git2/cherrypick.h
-- Installing: /usr/local/include/git2/merge.h
-- Installing: /usr/local/include/git2/transport.h
-- Installing: /usr/local/include/git2/errors.h
-- Installing: /usr/local/include/git2/filter.h
-- Installing: /usr/local/include/git2/blob.h
-- Installing: /usr/local/include/git2/net.h
-- Installing: /usr/local/include/git2/tree.h
-- Installing: /usr/local/include/git2/types.h
-- Installing: /usr/local/include/git2/annotated_commit.h
-- Installing: /usr/local/include/git2/pathspec.h
-- Installing: /usr/local/include/git2/clone.h
-- Installing: /usr/local/include/git2/odb.h
-- Installing: /usr/local/include/git2/status.h
-- Installing: /usr/local/include/git2/cred_helpers.h
-- Installing: /usr/local/include/git2/indexer.h
-- Installing: /usr/local/include/git2/config.h
-- Installing: /usr/local/include/git2/strarray.h
-- Installing: /usr/local/include/git2/submodule.h
-- Installing: /usr/local/include/git2/sys
-- Installing: /usr/local/include/git2/sys/commit.h
-- Installing: /usr/local/include/git2/sys/odb_backend.h
-- Installing: /usr/local/include/git2/sys/openssl.h
-- Installing: /usr/local/include/git2/sys/repository.h
-- Installing: /usr/local/include/git2/sys/hashsig.h
-- Installing: /usr/local/include/git2/sys/reflog.h
-- Installing: /usr/local/include/git2/sys/merge.h
-- Installing: /usr/local/include/git2/sys/transport.h
-- Installing: /usr/local/include/git2/sys/filter.h
-- Installing: /usr/local/include/git2/sys/refdb_backend.h
-- Installing: /usr/local/include/git2/sys/config.h
-- Installing: /usr/local/include/git2/sys/remote.h
-- Installing: /usr/local/include/git2/sys/index.h
-- Installing: /usr/local/include/git2/sys/diff.h
-- Installing: /usr/local/include/git2/sys/stream.h
-- Installing: /usr/local/include/git2/sys/time.h
-- Installing: /usr/local/include/git2/sys/mempack.h
-- Installing: /usr/local/include/git2/sys/refs.h
-- Installing: /usr/local/include/git2/remote.h
-- Installing: /usr/local/include/git2/ignore.h
-- Installing: /usr/local/include/git2/global.h
-- Installing: /usr/local/include/git2/patch.h
-- Installing: /usr/local/include/git2/index.h
-- Installing: /usr/local/include/git2/stash.h
-- Installing: /usr/local/include/git2/diff.h
-- Installing: /usr/local/include/git2/message.h
-- Installing: /usr/local/include/git2/common.h
-- Installing: /usr/local/include/git2/object.h
-- Installing: /usr/local/include/git2/oid.h
-- Installing: /usr/local/include/git2/proxy.h
-- Installing: /usr/local/include/git2/checkout.h
-- Installing: /usr/local/include/git2/inttypes.h
-- Installing: /usr/local/include/git2/describe.h
-- Installing: /usr/local/include/git2/reset.h
-- Installing: /usr/local/include/git2/oidarray.h
-- Installing: /usr/local/include/git2/pack.h
-- Installing: /usr/local/include/git2/stdint.h
-- Installing: /usr/local/include/git2/revert.h
-- Installing: /usr/local/include/git2/revparse.h
-- Installing: /usr/local/include/git2/revwalk.h
-- Installing: /usr/local/include/git2/version.h
-- Installing: /usr/local/include/git2/notes.h
-- Installing: /usr/local/include/git2/graph.h
-- Installing: /usr/local/include/git2/refspec.h
-- Installing: /usr/local/include/git2/rebase.h
-- Installing: /usr/local/include/git2/signature.h
-- Installing: /usr/local/include/git2/worktree.h
-- Installing: /usr/local/include/git2/blame.h
-- Installing: /usr/local/include/git2/refs.h
-- Installing: /usr/local/include/git2/attr.h
-- Installing: /usr/local/include/git2/refdb.h
-- Installing: /usr/local/include/git2/transaction.h
-- Installing: /usr/local/include/git2/branch.h
-- Installing: /usr/local/include/git2.h
osmc@osmc:~/Downloads/libgit2-0.26.0/build$ cd ../../bazarr/
osmc@osmc:~/Downloads/bazarr$ sudo pip install -r requirements.txt
Requirement already satisfied: apscheduler in /usr/local/lib/python2.7/dist-pack                                                              ages (from -r requirements.txt (line 1))
Requirement already satisfied: babelfish in /usr/local/lib/python2.7/dist-packag                                                              es (from -r requirements.txt (line 2))
Requirement already satisfied: bottle in /usr/local/lib/python2.7/dist-packages                                                               (from -r requirements.txt (line 3))
Requirement already satisfied: bottle-fdsend in /usr/local/lib/python2.7/dist-pa                                                              ckages (from -r requirements.txt (line 4))
Requirement already satisfied: dogpile.cache in /usr/local/lib/python2.7/dist-pa                                                              ckages (from -r requirements.txt (line 5))
Requirement already satisfied: enzyme in /usr/local/lib/python2.7/dist-packages                                                               (from -r requirements.txt (line 6))
Requirement already satisfied: Pillow in /usr/lib/python2.7/dist-packages (from                                                               -r requirements.txt (line 7))
Requirement already satisfied: py-pretty in /usr/local/lib/python2.7/dist-packag                                                              es (from -r requirements.txt (line 8))
Requirement already satisfied: pycountry in /usr/local/lib/python2.7/dist-packag                                                              es (from -r requirements.txt (line 9))
Collecting pygit2 (from -r requirements.txt (line 10))
  Using cached pygit2-0.26.2.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-WqTYaL/pygit2/setup.py", line 61, in <module>
        ffi.verify(preamble, **C_KEYWORDS)
      File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 340, in verify
        lib = self.verifier.load_library()
      File "/usr/lib/python2.7/dist-packages/cffi/verifier.py", line 75, in load_library
        return self._load_library()
      File "/usr/lib/python2.7/dist-packages/cffi/verifier.py", line 151, in _load_library
        return self._vengine.load_library()
      File "/usr/lib/python2.7/dist-packages/cffi/vengine_cpy.py", line 149, in load_library
        raise ffiplatform.VerificationError(error)
    cffi.ffiplatform.VerificationError: importing '/tmp/pip-build-WqTYaL/pygit2/__pycache__/_cffi__x554e6eaax4850a773.arm-linux-gnueabihf.so': libgit2.so.26: cannot open shared object file: No such file or directory

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-WqTYaL/pygit2/

@morpheus65535
Copy link
Owner

It’s more a pygit2 vs libgit2 problem. I think you’re going to need some help from the developers of those software. :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants