libgit2/pygit2

cffi ImportError during installation of v0.21.0

cvrebert opened this issue · 8 comments

$ uname -a
Darwin MACBOX.local 13.3.0 Darwin Kernel Version 13.3.0: Tue Jun  3 21:27:35 PDT 2014; root:xnu-2422.110.17~1/RELEASE_X86_64 x86_64
$ python -V
Python 2.7.7
$ pip -V
pip 1.5.6 from /Users/chris.rebert/envs/restfulgit/lib/python2.7/site-packages (python 2.7)
$ pip install pygit2
Downloading/unpacking pygit2
  Downloading pygit2-0.21.0.tar.gz (unknown size): 150kB downloaded
  Running setup.py (path:/Users/chris.rebert/envs/restfulgit/build/pygit2/setup.py) egg_info for package pygit2
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/Users/chris.rebert/envs/restfulgit/build/pygit2/setup.py", line 178, in <module>
        from ffi import ffi
      File "pygit2/ffi.py", line 34, in <module>
        from cffi import FFI
    ImportError: No module named cffi
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/Users/chris.rebert/envs/restfulgit/build/pygit2/setup.py", line 178, in <module>

    from ffi import ffi

  File "pygit2/ffi.py", line 34, in <module>

    from cffi import FFI

ImportError: No module named cffi

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /Users/chris.rebert/envs/restfulgit/build/pygit2
Storing debug log for failure in /Users/chris.rebert/.pip/pip.log
$ # Okay, maybe if I install cffi manually beforehand?
$ pip install cffi
<installation of cffi succeeds>
$ pip install pygit2
Downloading/unpacking pygit2
  Downloading pygit2-0.21.0.tar.gz (unknown size): 150kB downloaded
  Running setup.py (path:/Users/chris.rebert/envs/restfulgit/build/pygit2/setup.py) egg_info for package pygit2

Requirement already satisfied (use --upgrade to upgrade): cffi in /Users/chris.rebert/envs/restfulgit/lib/python2.7/site-packages (from pygit2)
Requirement already satisfied (use --upgrade to upgrade): pycparser in /Users/chris.rebert/envs/restfulgit/lib/python2.7/site-packages (from cffi->pygit2)
Installing collected packages: pygit2
  Running setup.py install for pygit2
    building '_pygit2' extension
<snip>
<the pygit2 installation succeeds this time>

Just updated the README file so it reads:

$ pip install cffi
$ pip install pygit2

Though, pip install pygit2 should just work.

Indeed, setup.py includes cffi as a dependency, and the output there seems to want to install it, but only after installing pygit2, which seems quite odd.

Perhaps it wants a version specification, something like ['cffi>=0.8'] instead of just ['cffi']?

The error message is the same when you just run python setup.py install in an environment without cffi. Loading setup.py just fails because the import cffi comes before the call to setup. There is an option setup_requires, not clear it will make a difference. Anyway for testing this before releasing we will need to use something like pypiserver.

This should be fixed with #407, correct?

I would think so yes. I haven't experienced it since.

I'm currently getting this issue in travis.

I'm getting this issue as well.

This should be fixed by commit 203335b, we will see with the next release.