0

I am tried to install pygit2 python library with pip on Redhat 7.0 but i got the following error. If anybody have an idea how to solve this problem please let me know. I would really appraciate any idea.

This is the console output after pip install pygit2:

  Collecting pygit2
      Using cached pygit2-0.22.1.tar.gz
        Complete output from command python setup.py egg_info:

        Installed /tmp/pip-build-hMIDbT/pygit2/.eggs/cffi-1.1.2-py2.7-linux-x86_64.egg
        Searching for pycparser
        Reading https://pypi.python.org/simple/pycparser/
        Best match: pycparser 2.14
        Downloading https://pypi.python.org/packages/source/p/pycparser/pycparser-2.14.tar.gz#md5=a2bc8d28c923b4fe2b2c3b4b51a4f935
        Processing pycparser-2.14.tar.gz
        Writing /tmp/easy_install-L0qnp1/pycparser-2.14/setup.cfg
        Running pycparser-2.14/setup.py -q bdist_egg --dist-dir /tmp/easy_install-L0qnp1/pycparser-2.14/egg-dist-tmp-OnOr01
        warning: no previously-included files matching 'yacctab.*' found under directory 'tests'
        warning: no previously-included files matching 'lextab.*' found under directory 'tests'
        warning: no previously-included files matching 'yacctab.*' found under directory 'examples'
        warning: no previously-included files matching 'lextab.*' found under directory 'examples'
        zip_safe flag not set; analyzing archive contents...
        Moving pycparser-2.14-py2.7.egg to /tmp/pip-build-hMIDbT/pygit2/.eggs

        Installed /tmp/pip-build-hMIDbT/pygit2/.eggs/pycparser-2.14-py2.7.egg
        running egg_info
        creating pip-egg-info/pygit2.egg-info
        writing requirements to pip-egg-info/pygit2.egg-info/requires.txt
        writing pip-egg-info/pygit2.egg-info/PKG-INFO
        writing top-level names to pip-egg-info/pygit2.egg-info/top_level.txt
        writing dependency_links to pip-egg-info/pygit2.egg-info/dependency_links.txt
        writing manifest file 'pip-egg-info/pygit2.egg-info/SOURCES.txt'
        warning: manifest_maker: standard file '-c' not found

        running build_ext
        building 'pygit2_cffi_3adedda7x2a59b7ee' extension
        creating /tmp/pip-build-hMIDbT/pygit2/pygit2/__pycache__/pygit2
        creating /tmp/pip-build-hMIDbT/pygit2/pygit2/__pycache__/pygit2/__pycache__
        gcc -pthread -fno-strict-aliasing -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -DNDEBUG -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -D_GNU_SOURCE -fPIC -fwrapv -fPIC -I/usr/local/include -I/usr/include/python2.7 -c pygit2/__pycache__/pygit2_cffi_3adedda7x2a59b7ee.c -o /tmp/pip-build-hMIDbT/pygit2/pygit2/__pycache__/pygit2/__pycache__/pygit2_cffi_3adedda7x2a59b7ee.o
        gcc -pthread -shared -Wl,-z,relro -Wl,-rpath=/lib,--enable-new-dtags /tmp/pip-build-hMIDbT/pygit2/pygit2/__pycache__/pygit2/__pycache__/pygit2_cffi_3adedda7x2a59b7ee.o -L/usr/local/lib -L/usr/lib64 -lgit2 -lpython2.7 -o /tmp/pip-build-hMIDbT/pygit2/pygit2/__pycache__/pygit2_cffi_3adedda7x2a59b7ee.so
        Traceback (most recent call last):
          File "<string>", line 20, in <module>
          File "/tmp/pip-build-hMIDbT/pygit2/setup.py", line 197, in <module>
            cmdclass=cmdclass)
          File "/usr/lib64/python2.7/distutils/core.py", line 151, in setup
            dist.run_commands()
          File "/usr/lib64/python2.7/distutils/dist.py", line 953, in run_commands
            self.run_command(cmd)
          File "/usr/lib64/python2.7/distutils/dist.py", line 972, in run_command
            cmd_obj.run()
          File "<string>", line 15, in replacement_run
          File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 207, in find_sources
            mm.run()
          File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 291, in run
            self.add_defaults()
          File "/usr/lib/python2.7/site-packages/setuptools/command/egg_info.py", line 320, in add_defaults
            sdist.add_defaults(self)
          File "/usr/lib/python2.7/site-packages/setuptools/command/sdist.py", line 118, in add_defaults
            build_py = self.get_finalized_command('build_py')
          File "/usr/lib64/python2.7/distutils/cmd.py", line 312, in get_finalized_command
            cmd_obj.ensure_finalized()
          File "/usr/lib64/python2.7/distutils/cmd.py", line 109, in ensure_finalized
            self.finalize_options()
          File "/usr/lib/python2.7/site-packages/setuptools/command/build_py.py", line 28, in finalize_options
            orig.build_py.finalize_options(self)
          File "/usr/lib64/python2.7/distutils/command/build_py.py", line 46, in finalize_options
            ('force', 'force'))
          File "/usr/lib64/python2.7/distutils/cmd.py", line 298, in set_undefined_options
            src_cmd_obj.ensure_finalized()
          File "/usr/lib64/python2.7/distutils/cmd.py", line 109, in ensure_finalized
            self.finalize_options()
          File "/tmp/pip-build-hMIDbT/pygit2/setup.py", line 103, in finalize_options
            ffi, C = get_ffi()
          File "pygit2/_utils.py", line 107, in get_ffi
            include_dirs=[libgit2_include], library_dirs=[libgit2_lib])
          File "/tmp/pip-build-hMIDbT/pygit2/.eggs/cffi-1.1.2-py2.7-linux-x86_64.egg/cffi/api.py", line 373, in verify
            lib = self.verifier.load_library()
          File "/tmp/pip-build-hMIDbT/pygit2/.eggs/cffi-1.1.2-py2.7-linux-x86_64.egg/cffi/verifier.py", line 97, in load_library
            return self._load_library()
          File "/tmp/pip-build-hMIDbT/pygit2/.eggs/cffi-1.1.2-py2.7-linux-x86_64.egg/cffi/verifier.py", line 207, in _load_library
            return self._vengine.load_library()
          File "/tmp/pip-build-hMIDbT/pygit2/.eggs/cffi-1.1.2-py2.7-linux-x86_64.egg/cffi/vengine_cpy.py", line 155, in load_library
            raise ffiplatform.VerificationError(error)
        cffi.ffiplatform.VerificationError: importing '/tmp/pip-build-hMIDbT/pygit2/pygit2/__pycache__/pygit2_cffi_3adedda7x2a59b7ee.so': libgit2.so.22: 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-hMIDbT/pygit2
eszik.k
  • 1,729
  • 4
  • 17
  • 40
  • "libgit2.so.22: cannot open shared object file: No such file or directory". I don't know what package libgit2 belongs to, but you may want to install that package (and thus libgit2) first. Possibly the development version, since you may need the header file as well (though it doesn't look like it). –  Jul 31 '15 at 11:26
  • You need to install the [requirements](http://www.pygit2.org/install.html#id2) – Burhan Khalid Jul 31 '15 at 11:28
  • I think this is a dependency for pygit2 and i already installed it. I followed this installion manual. – eszik.k Jul 31 '15 at 11:28
  • Red Hat 7.0 doesn't ship `pip` and it doesn't ship `libgit2`. Where from/how are you installing these? – larsks Jul 31 '15 at 12:13
  • Python pip: `sudo yum install python-devel python-pip python-lxml cairo pango gdk-pixbuf2 libffi-devel` and http://www.pygit2.org/install.html – eszik.k Jul 31 '15 at 12:20
  • *Where* did you install libgit2? You may have installed it, but perhaps not in a place where pygit2 can find it. Please add the location of libgit2.so to your question (and to your `LDFLAGS` when running pip). –  Jul 31 '15 at 15:43

1 Answers1

0

If you have manually installed libgit2, then you need to make sure that your OS knows where to find it when it's trying to load it. Installing to /usr/local/ in most systems will be enough, but sometimes you have to run sudo ldconfig for the library loader to recognise changes.

If you have not installed it in a standard location, you will have to export LD_LIBRARY_PATH or hardcode the path in the pygit2 module. This is equivalent to the case of (libgit2 within a virtual environment)[http://www.pygit2.org/install.html#libgit2-within-a-virtual-environment] from the installation documentation.

Carlos Martín Nieto
  • 5,207
  • 1
  • 15
  • 16