jbaiter / jpegtran-cffi

Fast, (mostly) lossless JPEG transformations with Python
http://jpegtran-cffi.readthedocs.org
MIT License
145 stars 23 forks source link

pip install fails unless cffi installed first and separately #27

Open cbm755 opened 4 years ago

cbm755 commented 4 years ago

This fails:

pip3 install cffi pycparser jpegtran-cffi

This also fails:

pip3 install jpegtran-cffi

But this succeeds:

pip3 install cffi pycparser
pip3 install jpegtran-cffi

Because of this I cannot figure out how to put jpegtran-cffi into a requirements.txt.

Maybe something wrong with how cffi is specified as a dependency? See also #26 which mentions pip not working "out of the box"...

Here's the output on a fairly barebones Ubuntu 18.04 docker image:

# python3 -m pip install cffi jpegtran-cffi
Collecting cffi
  Downloading cffi-1.14.0-cp37-cp37m-manylinux1_x86_64.whl (400 kB)
     |████████████████████████████████| 400 kB 1.1 MB/s 
Collecting jpegtran-cffi
  Downloading jpegtran-cffi-0.5.2.tar.gz (138 kB)
     |████████████████████████████████| 138 kB 705 kB/s 
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ul9qq_v2/jpegtran-cffi/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ul9qq_v2/jpegtran-cffi/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-pip-egg-info-py95kfzq
         cwd: /tmp/pip-install-ul9qq_v2/jpegtran-cffi/
    Complete output (11 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-ul9qq_v2/jpegtran-cffi/setup.py", line 5, in <module>
        import jpegtran.lib
      File "/tmp/pip-install-ul9qq_v2/jpegtran-cffi/jpegtran/__init__.py", line 1, in <module>
        from jpegtran.transform import JPEGImage
      File "/tmp/pip-install-ul9qq_v2/jpegtran-cffi/jpegtran/transform.py", line 5, in <module>
        import jpegtran.lib as lib
      File "/tmp/pip-install-ul9qq_v2/jpegtran-cffi/jpegtran/lib.py", line 10, in <module>
        from cffi import FFI
    ModuleNotFoundError: No module named 'cffi'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
cbm755 commented 4 years ago

Oops I didn't look at closed issues... I see #6 looks like this. But it does not appear to be solved, or perhaps has re-appeared on more modern pip?

WillBrennan commented 3 years ago

bump; just had the same issue again when installing from pip.

Looks like pip only goes up to 0.5.2 but you had version 0.6a1 in your setup.py when you made fixes 022aa33 and e9cb057. Is this issue now resolved?

anton-brandl commented 2 years ago

bump; Same issue :/ This happens to me even when first installing cffi

cbm755 commented 2 years ago

I'm not really using this library anymore but I still bundle it in my docker image: https://gitlab.com/plom/plom/-/blob/main/Dockerfile#L39 where this workaround seems to be still working for me:

pip install cffi pycparser
pip install jpegtran-cffi
mbaksa commented 1 year ago

Those two pip lines of code don't work anymore:

pip install cffi pycparser
pip install jpegtran-cffi

With pip 23.2 i get an error:

Getting requirements to build wheel ... error
error: subprocess-exited-with-error
toyg commented 1 year ago

Same problem for me. Using 3.11.4 built with (homebrew-provided) pyenv.

Collecting jpegtran-cffi
  Using cached jpegtran-cffi-0.5.2.tar.gz (138 kB)
  Installing build dependencies ... done
  Getting requirements to build wheel ... error
  error: subprocess-exited-with-error

  × Getting requirements to build wheel did not run successfully.
  │ exit code: 1
  ╰─> [27 lines of output]
      Traceback (most recent call last):
        File "/Users/toyg/.pyenv/versions/3.11.4/envs/conanscrape/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 353, in <module>
          main()
        File "/Users/toyg/.pyenv/versions/3.11.4/envs/conanscrape/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 335, in main
          json_out['return_val'] = hook(**hook_input['kwargs'])
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/Users/toyg/.pyenv/versions/3.11.4/envs/conanscrape/lib/python3.11/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 118, in get_requires_for_build_wheel
          return hook(config_settings)
                 ^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/wc/csdscxjx55n5wkft51130s2h0000gn/T/pip-build-env-wl0hfiog/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 341, in get_requires_for_build_wheel
          return self._get_build_requires(config_settings, requirements=['wheel'])
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/wc/csdscxjx55n5wkft51130s2h0000gn/T/pip-build-env-wl0hfiog/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 323, in _get_build_requires
          self.run_setup()
        File "/private/var/folders/wc/csdscxjx55n5wkft51130s2h0000gn/T/pip-build-env-wl0hfiog/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 488, in run_setup
          self).run_setup(setup_script=setup_script)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/wc/csdscxjx55n5wkft51130s2h0000gn/T/pip-build-env-wl0hfiog/overlay/lib/python3.11/site-packages/setuptools/build_meta.py", line 338, in run_setup
          exec(code, locals())
        File "<string>", line 5, in <module>
        File "/private/var/folders/wc/csdscxjx55n5wkft51130s2h0000gn/T/pip-install-9yxbto9t/jpegtran-cffi_1c4c581e2b564e7e9d13f302a68e5a92/jpegtran/__init__.py", line 1, in <module>
          from jpegtran.transform import JPEGImage
        File "/private/var/folders/wc/csdscxjx55n5wkft51130s2h0000gn/T/pip-install-9yxbto9t/jpegtran-cffi_1c4c581e2b564e7e9d13f302a68e5a92/jpegtran/transform.py", line 5, in <module>
          import jpegtran.lib as lib
        File "/private/var/folders/wc/csdscxjx55n5wkft51130s2h0000gn/T/pip-install-9yxbto9t/jpegtran-cffi_1c4c581e2b564e7e9d13f302a68e5a92/jpegtran/lib.py", line 10, in <module>
          from cffi import FFI
      ModuleNotFoundError: No module named 'cffi'
      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: subprocess-exited-with-error

× Getting requirements to build wheel did not run successfully.
│ exit code: 1
╰─> See above for output.

note: This error originates from a subprocess, and is likely not a problem with pip.