Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setup fails when cffi isn't installed already #6

Closed
letmaik opened this issue Sep 8, 2014 · 2 comments
Closed

setup fails when cffi isn't installed already #6

letmaik opened this issue Sep 8, 2014 · 2 comments

Comments

@letmaik
Copy link

letmaik commented Sep 8, 2014

A simple pip install jpegtran-cffi fails if cffi isn't installed already:

Downloading/unpacking jpegtran-cffi
  Downloading jpegtran-cffi-0.5.tar.gz (42kB): 42kB downloaded
  Running setup.py egg_info for package jpegtran-cffi
    Traceback (most recent call last):
      File "<string>", line 16, in <module>
      File "/tmp/pip_build_maik/jpegtran-cffi/setup.py", line 4, in <module>
        import jpegtran.lib
      File "jpegtran/__init__.py", line 1, in <module>
        from jpegtran.transform import JPEGImage
      File "jpegtran/transform.py", line 5, in <module>
        import jpegtran.lib as lib
      File "jpegtran/lib.py", line 9, 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 16, in <module>

  File "/tmp/pip_build_maik/jpegtran-cffi/setup.py", line 4, in <module>

    import jpegtran.lib

  File "jpegtran/__init__.py", line 1, in <module>

    from jpegtran.transform import JPEGImage

  File "jpegtran/transform.py", line 5, in <module>

    import jpegtran.lib as lib

  File "jpegtran/lib.py", line 9, in <module>

    from cffi import FFI

ImportError: No module named cffi

In the setup.py it is listed correctly as dependency but already at line 4 it tries to import jpegtran.lib which fails as it needs cffi.

@jbaiter
Copy link
Owner

jbaiter commented Sep 8, 2014

Yes, this is a known limitation with CFFI.

See this comment from CFFI's author:

Setuptools has the "setup_requires" keyword that allows you to specify early
dependencies. But pip doesn't honor it. So I'm not sure it can be fixed. Pip
seems to install dependencies after the package itself. But setup.py would
need to have access to cffi to install the extension.

Argh, unhappiness :-( It seems that on this front, we cannot really
do better that what you did, which is to explain to the user that he
needs to run "pip install cffi" explicitly first...

However, another person on that mailing list thread seems to have found a rather hacky workaround, I'll see if I can use it in our case.

@stefanor
Copy link

cffi 1.0's improved build system should solve this. https://cffi.readthedocs.org/en/latest/cdef.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants