python3-pygit2 installation with apt-get is incomplete

Bug #1475431 reported by Alex Nelson
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-pygit2 (Debian)
Fix Released
Unknown
python-pygit2 (Ubuntu)
Fix Released
High
Unassigned

Bug Description

Hello,

I just attempted to use pygit2 in Python3.4 on today's daily build of Ubuntu 15.10. (15.04 doesn't seem to have pygit2 packaged.)

Though I am filing this bug against python-pygit2, I encountered the issue by installing python3-pygit2, which Launchpad isn't finding. Python 2 suffers the same issue.

Expected behavior:
I expect these two commands to exit without error when issued (after enabling the universe packages):
sudo apt-get install python-pygit2
python -c 'import pygit2'

Actual behavior:
python-pygit2 installs fine.
Output from the Python command, triple-quoted:
"""
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/pygit2/__init__.py", line 35, in <module>
    from .blame import Blame, BlameHunk
  File "/usr/lib/python2.7/dist-packages/pygit2/blame.py", line 32, in <module>
    from .errors import check_error
  File "/usr/lib/python2.7/dist-packages/pygit2/errors.py", line 29, in <module>
    from .ffi import ffi, C
  File "/usr/lib/python2.7/dist-packages/pygit2/ffi.py", line 35, in <module>
    ffi, C = get_ffi()
  File "/usr/lib/python2.7/dist-packages/pygit2/_utils.py", line 101, in get_ffi
    include_dirs=[libgit2_include], library_dirs=[libgit2_lib])
  File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 373, in verify
    lib = self.verifier.load_library()
  File "/usr/lib/python2.7/dist-packages/cffi/verifier.py", line 95, in load_library
    self._write_source()
  File "/usr/lib/python2.7/dist-packages/cffi/verifier.py", line 183, in _write_source
    with open(self.sourcefilename, "w") as fp:
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.7/dist-packages/pygit2/__pycache__/pygit2_cffi_ab5e9344x5470904.c'
"""

Possible resolution:
Since it looks like a missing generated-cache file, 'sudo !!' looked like a viable next step. A missing Python.h notice suggests the 'python-dev' package was needed. Trying to import pygit2 again showed a complaint for a missing git2.h, suggesting the package 'libgit2-dev' was needed. Finally, one last "sudo python -c 'import pygit2'" creates another needed object file. pygit2 is usable after that.
The above resolution works the same with Python 3.
From the "-dev" packages and sudo calls needed, it looks like pygit2 as packaged doesn't complete all of the building necessary.

Revision history for this message
Alex Nelson (alexander-nelson-b) wrote :

One more note on execution environment: I performed this test on the 2015-07-16 Ubuntu 15.10 daily build ISO, within the Live environment.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :
Download full text (3.4 KiB)

Thanks for taking your time to report this issue and help making Ubuntu better.

I get the same error message when attempting to import pygit2 (version 0.22.0-3) on Ubuntu Wily, see below for error messages. Though, after installing python-dev, python3-dev and libgit2-dev, and prefixing the imports with sudo it looks like things started to work. Strange.

>Though I am filing this bug against python-pygit2, I encountered the issue by installing python3-pygit2, which Launchpad isn't finding.

You've come to the right place. Launchpad keeps track of the source package, which in this case is called python-pygit2. The source package is then built to produce the binary packages, which are the installable ones. Since multiple binary packages might come from the same source package, bug reports are reported against the source package. Btw, if you report bugs via `ubuntu-bug` it will automatically look up and file the report against the correct source package. You may learn more about ubuntu-bug (and bug reporting in general) at https://wiki.ubuntu.com/ReportingBugs.

$ python -c 'import pygit2'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python2.7/dist-packages/pygit2/__init__.py", line 35, in <module>
    from .blame import Blame, BlameHunk
  File "/usr/lib/python2.7/dist-packages/pygit2/blame.py", line 32, in <module>
    from .errors import check_error
  File "/usr/lib/python2.7/dist-packages/pygit2/errors.py", line 29, in <module>
    from .ffi import ffi, C
  File "/usr/lib/python2.7/dist-packages/pygit2/ffi.py", line 35, in <module>
    ffi, C = get_ffi()
  File "/usr/lib/python2.7/dist-packages/pygit2/_utils.py", line 101, in get_ffi
    include_dirs=[libgit2_include], library_dirs=[libgit2_lib])
  File "/usr/lib/python2.7/dist-packages/cffi/api.py", line 373, in verify
    lib = self.verifier.load_library()
  File "/usr/lib/python2.7/dist-packages/cffi/verifier.py", line 95, in load_library
    self._write_source()
  File "/usr/lib/python2.7/dist-packages/cffi/verifier.py", line 183, in _write_source
    with open(self.sourcefilename, "w") as fp:
IOError: [Errno 2] No such file or directory: '/usr/lib/python2.7/dist-packages/pygit2/__pycache__/pygit2_cffi_ab5e9344x5470904.c'

$ python3 -c 'import pygit2'
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/pygit2/__init__.py", line 35, in <module>
    from .blame import Blame, BlameHunk
  File "/usr/lib/python3/dist-packages/pygit2/blame.py", line 32, in <module>
    from .errors import check_error
  File "/usr/lib/python3/dist-packages/pygit2/errors.py", line 29, in <module>
    from .ffi import ffi, C
  File "/usr/lib/python3/dist-packages/pygit2/ffi.py", line 35, in <module>
    ffi, C = get_ffi()
  File "/usr/lib/python3/dist-packages/pygit2/_utils.py", line 101, in get_ffi
    include_dirs=[libgit2_include], library_dirs=[libgit2_lib])
  File "/usr/lib/python3/dist-packages/cffi/api.py", line 373, in verify
    lib = self.verifier.load_library()
  File "/usr/lib/python3/dist-packages/cffi/verifier.py", line 95, in load_library
    s...

Read more...

Changed in python-pygit2 (Ubuntu):
status: New → Confirmed
tags: added: wily
Changed in python-pygit2 (Debian):
status: Unknown → Fix Released
Changed in python-pygit2 (Ubuntu):
importance: Undecided → High
Revision history for this message
Hans Joachim Desserud (hjd) wrote :

The Debian bug report was closed, but since I found that I am still able to reproduce this issue, I have filed a new one. See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=796657 for details.

Revision history for this message
Alex Nelson (alexander-nelson-b) wrote :

I was able to use pygit2 on the 2015-09-14 Ubuntu nightly build. These commands, and some subsequent quick testing on a small Git repository, worked:

sudo apt-get install python-3pygit2
python3 -c 'import pygit2'

I consider this issue resolved for Ubuntu. I also see that the Debian bug is reported as fixed.

Revision history for this message
Hans Joachim Desserud (hjd) wrote :

Indeed. I am no longer able to reproduce this issue either with python3-pygit2 0.22.0-3build1 (and libgit2 0.22.2-2) on Ubuntu Wily.

Which I at first found a bit odd, since it didn't go away in Debian Sid until python3-pygit2 0.23.0-1 (see the Debian bug I reported in comment #3). Though I see that the package has been rebuilt in Wily, so maybe that sorted it out.

In any case, I belive this issue has been resolved so I'm marking this Fix Released.

Changed in python-pygit2 (Ubuntu):
status: Confirmed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.