Bug 1313102

Summary: PermissionError: import pygit2: Can't import python3-pygit2 after install
Product: [Fedora] Fedora Reporter: Jon Dufresne <jon.dufresne>
Component: python-pygit2Assignee: Pete Walter <walter.pete>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 23CC: i, ignatenko, quantum.analyst, walter.pete
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: python-pygit2-0.24.0-1.fc24 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-03-31 20:29:36 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Jon Dufresne 2016-03-01 00:08:57 UTC
Description of problem:
python3-pygit2 fails to import. Everytime.


Version-Release number of selected component (if applicable):
Name        : python3-pygit2
Arch        : x86_64
Epoch       : 0
Version     : 0.23.0
Release     : 0.1.fc23
Size        : 565 k
Repo        : @System
From repo   : fedora
Summary     : Python 3.x bindings for libgit2
URL         : http://www.pygit2.org
License     : GPLv2 with linking exception
Description : pygit2 is a set of Python bindings to the libgit2 library, which implements
            : the core of Git. Pygit2 works with Python 2.7, 3.1, 3.2, 3.3 and 3.4.

How reproducible:
100%


Steps to Reproduce:
1. Install package python3-pygit2
2. Start python3
3. Import pygit2

Actual results:
PermissionError: [Errno 13] Permission denied: '/usr/lib64/python3.4/site-packages/pygit2/__pycache__/pygit2_cffi_6bc76ceexe8494016.c'


Expected results:
pygit2 imports successfully.


Additional info:
$ python3
Python 3.4.3 (default, Jun 29 2015, 12:16:01) 
[GCC 5.1.1 20150618 (Red Hat 5.1.1-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pygit2
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.4/site-packages/pygit2/__init__.py", line 35, in <module>
    from .blame import Blame, BlameHunk
  File "/usr/lib64/python3.4/site-packages/pygit2/blame.py", line 32, in <module>
    from .errors import check_error
  File "/usr/lib64/python3.4/site-packages/pygit2/errors.py", line 29, in <module>
    from .ffi import ffi, C
  File "/usr/lib64/python3.4/site-packages/pygit2/ffi.py", line 35, in <module>
    ffi, C = get_ffi()
  File "/usr/lib64/python3.4/site-packages/pygit2/_utils.py", line 107, in get_ffi
    include_dirs=[libgit2_include], library_dirs=[libgit2_lib])
  File "/usr/lib64/python3.4/site-packages/cffi/api.py", line 424, in verify
    lib = self.verifier.load_library()
  File "/usr/lib64/python3.4/site-packages/cffi/verifier.py", line 109, in load_library
    self._write_source()
  File "/usr/lib64/python3.4/site-packages/cffi/verifier.py", line 198, in _write_source
    with open(self.sourcefilename, "w") as fp:
PermissionError: [Errno 13] Permission denied: '/usr/lib64/python3.4/site-packages/pygit2/__pycache__/pygit2_cffi_6bc76ceexe8494016.c'

Comment 1 Elliott Sales de Andrade 2016-03-02 06:18:10 UTC
Dupe of Bug 1311161?

Comment 2 Jon Dufresne 2016-03-02 15:22:02 UTC
> Dupe of Bug 1311161?

I'm not sure.

I already have libgit2-devel installed. So I've worked around the other bug. The error shown in the two different tickets is different.

What I find strange is that some kind of gcc and C compilation occurs at runtime instead of package install time.

Comment 3 Fedora Update System 2016-03-29 23:04:27 UTC
rubygem-rugged-0.24.0-1.fc24 julia-0.4.5-2.fc24 gnome-builder-3.20.0-1.fc24 gitg-3.20.0-1.fc24 subsurface-4.4.2-5.fc24 python-pygit2-0.24.0-1.fc24 libgit2-glib-0.24.0-2.fc24 libgit2-0.24.0-1.fc24 has been submitted as an update to Fedora 24. https://bodhi.fedoraproject.org/updates/FEDORA-2016-fadc1e6504

Comment 4 Fedora Update System 2016-03-30 22:26:24 UTC
gitg-3.20.0-1.fc24, gnome-builder-3.20.0-1.fc24, julia-0.4.5-2.fc24, kate-15.12.3-2.fc24, kf5-ktexteditor-5.20.0-3.fc24, libgit2-0.24.0-1.fc24, libgit2-glib-0.24.0-2.fc24, python-pygit2-0.24.0-1.fc24, rubygem-rugged-0.24.0-1.fc24, subsurface-4.4.2-5.fc24 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2016-fadc1e6504

Comment 5 Fedora Update System 2016-03-31 20:29:27 UTC
gitg-3.20.0-1.fc24, gnome-builder-3.20.0-1.fc24, julia-0.4.5-2.fc24, kate-15.12.3-2.fc24, kf5-ktexteditor-5.20.0-3.fc24, libgit2-0.24.0-1.fc24, libgit2-glib-0.24.0-2.fc24, python-pygit2-0.24.0-1.fc24, rubygem-rugged-0.24.0-1.fc24, subsurface-4.4.2-5.fc24 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.