Компиляция #include <git2.h> завершается. && ImportError: Никакой модуль, названный cffi

предложите, фиксирует:

$ sudo pip2 install pygit2
The directory '/home/mona/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/mona/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pygit2
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:318: SNIMissingWarning: An HTTPS request has been made, but the SNI (Subject Name Indication) extension to TLS is not available on this platform. This may cause the server to present an incorrect TLS certificate, which can cause validation failures. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#snimissingwarning.
  SNIMissingWarning
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py:122: InsecurePlatformWarning: A true SSLContext object is not available. This prevents urllib3 from configuring SSL appropriately and may cause certain SSL connections to fail. You can upgrade to a newer version of Python to solve this. For more information, see https://urllib3.readthedocs.io/en/latest/security.html#insecureplatformwarning.
  InsecurePlatformWarning
  Downloading pygit2-0.25.0.tar.gz (472kB)
    100% |████████████████████████████████| 481kB 1.6MB/s 
Requirement already satisfied: cffi in /usr/local/lib/python2.7/dist-packages (from pygit2)
Requirement already satisfied: six in /usr/local/lib/python2.7/dist-packages (from pygit2)
Requirement already satisfied: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi->pygit2)
Installing collected packages: pygit2
  Running setup.py install for pygit2 ... error
    Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8v7fxX/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 /tmp/pip-PWP388-record/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-2.7
    creating build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/index.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/py2.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/utils.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/blame.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/ffi.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/remote.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/submodule.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/py3.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/errors.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/config.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/credentials.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/refspec.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/__init__.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/_build.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/settings.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/_run.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/repository.py -> build/lib.linux-x86_64-2.7/pygit2
    copying pygit2/decl.h -> build/lib.linux-x86_64-2.7/pygit2
    running build_ext
    generating cffi module 'build/temp.linux-x86_64-2.7/pygit2._libgit2.c'
    creating build/temp.linux-x86_64-2.7
    building '_pygit2' extension
    creating build/temp.linux-x86_64-2.7/src
    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/include/python2.7 -c src/blob.c -o build/temp.linux-x86_64-2.7/src/blob.o
    In file included from src/blob.c:30:0:
    src/blob.h:33:18: fatal error: git2.h: No such file or directory
     #include <git2.h>
                      ^
    compilation terminated.
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    ----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-build-8v7fxX/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 /tmp/pip-PWP388-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-build-8v7fxX/pygit2/

Это было в результате попытки к установке следующего пакета:

$ sudo pip2 install cffi
The directory '/home/mona/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/mona/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already satisfied: cffi in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi)
mona@pascal:~/computer_vision/jupyter_distracted_driver$ jupyter notebook
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/usr/local/lib/python2.7/dist-packages/notebook/notebookapp.py", line 31, in <module>
    from zmq.eventloop import ioloop
  File "/usr/lib/python2.7/dist-packages/zmq/__init__.py", line 62, in <module>
    from zmq.backend import *
  File "/usr/lib/python2.7/dist-packages/zmq/backend/__init__.py", line 22, in <module>
    _ns = select_backend('zmq.backend.cffi')
  File "/usr/lib/python2.7/dist-packages/zmq/backend/select.py", line 31, in select_backend
    mod = __import__(name, fromlist=public_api)
ImportError: No module named cffi

ОБНОВЛЕНИЕ:

$  pip2 install cffi
Requirement already satisfied: cffi in /usr/local/lib/python2.7/dist-packages
Requirement already satisfied: pycparser in /usr/local/lib/python2.7/dist-packages (from cffi)
mona@pascal:~/computer_vision/jupyter_distracted_driver$ jupyter notebook
Traceback (most recent call last):
  File "/usr/local/bin/jupyter-notebook", line 7, in <module>
    from notebook.notebookapp import main
  File "/usr/local/lib/python2.7/dist-packages/notebook/notebookapp.py", line 31, in <module>
    from zmq.eventloop import ioloop
  File "/usr/lib/python2.7/dist-packages/zmq/__init__.py", line 62, in <module>
    from zmq.backend import *
  File "/usr/lib/python2.7/dist-packages/zmq/backend/__init__.py", line 22, in <module>
    _ns = select_backend('zmq.backend.cffi')
  File "/usr/lib/python2.7/dist-packages/zmq/backend/select.py", line 31, in select_backend
    mod = __import__(name, fromlist=public_api)
ImportError: No module named cffi
0
задан 23 January 2017 в 15:35

2 ответа

На основе вывода Вы обеспечили, кажется, что Вы пропускаете файл, названный git.h и быстрым поиском недостаточно использованного , Поиск Пакета Ubuntu указывает, что этот файл является частью libgit2-dev пакета. Возможно, установка этого и попытка скомпилировать снова разрешили бы Ваши проблемы.

Вам будет нужно к , включают Репозиторий Вселенной

и затем выпускают команду

sudo apt-get update&&sudo apt-get install libgit2-dev

После того, как эта Ваша компиляция должна завершиться, и необходимо смочь продолжить двигаться.

0
ответ дан 7 November 2019 в 02:58

Ответ (sudo-H) был скрытым ответом в Вашем первом журнале ошибок. Я просто попробовал это, и это хорошо работало:

sudo -H pip2 install jupyter
0
ответ дан 7 November 2019 в 02:58

Другие вопросы по тегам:

Похожие вопросы: